-
Notifications
You must be signed in to change notification settings - Fork 208
V1 schedule.onRun doesn't call onInit #1680
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I found a few problems with this issue:
|
Hi @tecbot, Thanks for reporting this issue! We’ve received it and are reviewing it. We’ll provide updates as soon as possible. |
If you have time, could you produce some code that demonstrates this issue? |
I already referenced the misleading code lines. Creating a v1 pubsub trigger will cause the issue always: import { onInit } from 'firebase-functions'
import * as functions from 'firebase-functions/v1'
import { info } from 'firebase-functions/logger'
onInit(() => {
info("onInit called")
})
export const myFunction = functions
.pubsub.schedule('*/10 * * * *')
.onRun(() => {
info("function executed")
}) Expected log output:
Actual:
|
Appreciate it! It's just so whoever picks this up can easily reproduce and also use it to verify their fix works. |
Reproduced |
firebase-functions: 6.3.2
If creating a schedule.onRun function, onInit is not called because of this lines:
Will set label deployment-scheduled to true
firebase-functions/src/v1/providers/pubsub.ts
Line 155 in cce55b5
makeCloudFunction is wrapping withInit on the first line
firebase-functions/src/v1/cloud-functions.ts
Line 370 in cce55b5
However, because of the deployment-scheduled label it uses the non wrapped handler:
firebase-functions/src/v1/cloud-functions.ts
Line 411 in cce55b5
Expected behavior
onInit callback is called
Actual behavior
onInit is not called and causes issues with the function execution
The text was updated successfully, but these errors were encountered: