-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Description
I'm trying to get the beforeSignin
trigger function to work using the emulator on demo projects (--project demo-xxxx
/ 12.7.0 / macOS) but that's not triggering while perfectly working in production. I'm able to login and write to the database
in the emulator, but no beforeSignin
trigger. I've spent the whole day trying, but nothing in the logs.
I double checked that both auth
and functions
are started and running in the emulator, and correctly set the projectId
to demo-test
in my client as suggested:
initializeApp({
projectId: "demo-test",
apiKey: "useless",
databaseURL: "https://demo-test.firebaseio.com",
})
const auth = getAuth()
connectAuthEmulator(auth, "http://127.0.0.1:9099")
auth.settings.appVerificationDisabledForTesting = true
I also tried to to set the projectId
in the function, which should be useless, but with no luck:
import {beforeUserSignedIn} from "firebase-functions/v2/identity"
import {initializeApp} from "firebase-admin/app"
initializeApp({
projectId: "demo-test",
})
export const beforesignin = beforeUserSignedIn(async (event) => {
console.log(`beforesignin: ${JSON.stringify(event.data)}`)
})
Is there anything else I'm not aware of to get it working on demo-projects emulation ?
➜ firebase emulators:start --project demo-test
i emulators: Starting emulators: auth, functions, database
i emulators: Detected demo project ID "demo-test", emulated services will use a demo configuration and attempts to access non-emulated services for this project will fail.
i database: Database Emulator logging to database-debug.log
i ui: Emulator UI logging to ui-debug.log
✔ functions: Loaded functions definitions from source: beforesignin.
✔ functions[us-central1-beforesignin]: providers/cloud.auth/eventTypes/user.beforeSignIn function initialized (http://127.0.0.1:5001/demo-test/us-central1/beforesignin).
┌─────────────────────────────────────────────────────────────┐
│ ✔ All emulators ready! It is now safe to connect your app. │
│ i View Emulator UI at http://127.0.0.1:4000/ │
└─────────────────────────────────────────────────────────────┘
┌────────────────┬────────────────┬─────────────────────────────────┐
│ Emulator │ Host:Port │ View in Emulator UI │
├────────────────┼────────────────┼─────────────────────────────────┤
│ Authentication │ 127.0.0.1:9099 │ http://127.0.0.1:4000/auth │
├────────────────┼────────────────┼─────────────────────────────────┤
│ Functions │ 127.0.0.1:5001 │ http://127.0.0.1:4000/functions │
├────────────────┼────────────────┼─────────────────────────────────┤
│ Database │ 127.0.0.1:9000 │ http://127.0.0.1:4000/database │
└────────────────┴────────────────┴─────────────────────────────────┘
Emulator Hub running at 127.0.0.1:4400
Other reserved ports: 4500
Issues? Report them at https://github.com/firebase/firebase-tools/issues and attach the *-debug.log files.
headdetect