Skip to content

Cannot start emulator with only 'beforeSignIn' blocking function #4617

@dvoloshyn

Description

@dvoloshyn

[REQUIRED] Environment info

firebase-tools: 11.0.1

Platform: Manjaro Linux

[REQUIRED] Test case

export const beforeSignIn = auth.user().beforeSignIn((user, context) => { });

[REQUIRED] Steps to reproduce

  1. Create a firebase blocking function 'beforeSignIn', do not create a function 'beforeCreate'
  2. Try to start local emulator for functions and auth
  3. Observe errors
    `
    ✔ functions[us-central1-beforeSignIn]: providers/cloud.auth/eventTypes/user.beforeSignIn function initialized (http://localhost:5001/incubator-5dol/us-central1/beforeSignIn).
    ⚠ Error updating blocking functions config to the auth emulator: FirebaseError: HTTP Error: 400, INVALID_BLOCKING_FUNCTION: ((Expected an absolute URI with valid scheme and host.))

`
5. Now additionally add 'beforeCreate'
6. Observe emulators starting successfully
7. A had a quick glance at the source code and it looks like blocking functions config by default is initialized to ''. When only one function is present still both functions are being registered and don't pass validation. Maybe registering only those that are initialized should fix the issue.

[REQUIRED] Expected behavior

Emulators should start successfully even if only one of two blocking functions is present

[REQUIRED] Actual behavior

`
✔ functions[us-central1-beforeSignIn]: providers/cloud.auth/eventTypes/user.beforeSignIn function initialized (http://localhost:5001/incubator-5dol/us-central1/beforeSignIn).
⚠ Error updating blocking functions config to the auth emulator: FirebaseError: HTTP Error: 400, INVALID_BLOCKING_FUNCTION: ((Expected an absolute URI with valid scheme and host.))

`

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions