Skip to content

fix(v1): run onInit before task queue and auth blocking handlers - #2003

Open
IzaakGough wants to merge 1 commit into
masterfrom
@invertase/fix-v1-oninit-tasks-auth-blocking
Open

IzaakGough wants to merge 1 commit into
masterfrom
@invertase/fix-v1-oninit-tasks-auth-blocking

Conversation

@IzaakGough

@IzaakGough IzaakGough commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #2001.

v1 task queue functions (tasks.taskQueue().onDispatch) and v1 auth blocking functions (auth.user().beforeCreate, beforeSignIn, beforeEmail, beforeSms) ran their handler without running the onInit callback first.

This runs onInit before these handlers, as other v1 triggers and the v2 equivalents already do.

Tested with unit tests, the emulators, and a live deploy. beforeEmail and beforeSms are covered by unit tests only.

relnote: v1 task queue and auth blocking functions now run the onInit callback before the handler.

v1 taskQueue().onDispatch and auth.user().beforeCreate, beforeSignIn,
beforeEmail and beforeSms built their handler without withInit, so the
onInit callback never ran for them. Fixes #2001.

relnote: v1 task queue and auth blocking functions now run the onInit callback.
@IzaakGough
IzaakGough marked this pull request as ready for review November 26, 2026 15:51

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request integrates initialization logic (withInit) into v1 auth blocking functions and task queue handlers, ensuring that any registered onInit callbacks are executed when these functions run. Corresponding unit tests have been added to verify this behavior. Feedback suggests addressing test output pollution caused by multiple onInit registrations across tests, recommending either stubbing logger.warn or introducing a test-only reset helper.

Comment thread spec/v1/providers/auth.spec.ts Resolved
Comment thread src/v1/providers/tasks.ts Resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

v1 task queue and auth blocking functions do not run the onInit callback

2 participants