Skip to content

regression with firebase-functions-test wrapping a v1 scheduled function #1541

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

Closed
dereekb opened this issue Mar 24, 2024 · 2 comments · Fixed by #1545
Closed

regression with firebase-functions-test wrapping a v1 scheduled function #1541

dereekb opened this issue Mar 24, 2024 · 2 comments · Fixed by #1545

Comments

@dereekb
Copy link

dereekb commented Mar 24, 2024

Related issues

[REQUIRED] Version info

node:
v18.19.0

firebase-functions:
4.8.1

firebase-tools:
13.5.2

firebase-admin:
12.0.0

[REQUIRED] Test case

I have a test that is now failing after upgrading to firebase-functions 4.8.1 from 4.7.0. I'm assuming it was caused by #1540 but I haven't dug into figuring out why. Posting it here since I'd expect v1 code to not be changing with v2 functions/scheduler out. This might be a firebase-functions-test thing that needs to be updated so I will be cross-posting it there too.

The stack trace of the error I am now getting:

https://app.circleci.com/pipelines/github/dereekb/dbx-components/4042/workflows/319ed827-7a0f-40fd-99e5-d60998bf2746/jobs/12567/tests#failed-test-0

TypeError: func is not a function
    at Function.run (/home/circleci/code/node_modules/firebase-functions/lib/common/onInit.js:33:16)
    at scheduledWrapped (/home/circleci/code/node_modules/firebase-functions-test/lib/v1.js:40:34)
    at /home/circleci/code/packages/firebase-server/src/lib/nest/function/v1/nest.spec.ts:165:15
...

The relevant functions:
https://github.com/firebase/firebase-functions/blob/5cec90540d5f35d7950d745a4567b571f0758459/src/common/onInit.ts
https://github.com/firebase/firebase-functions-test/blob/5410568cd82726d32b245164e44fcd062833d75d/src/v1.ts#L134

[REQUIRED] Steps to reproduce

The scheduled.spec.ts test suite on firebase-functions-test fails when using 4.8.1.

Screenshot 2024-03-24 at 2 47 33 PM

My repo is here:

https://github.com/dereekb/firebase-functions-test

npm install
npm run test

[REQUIRED] Expected behavior

The scheduled function should execute properly in testing.

[REQUIRED] Actual behavior

The scheduled function does not execute properly in testing. Unsure how this affects deployed scheduled functions but I'd assume they're unaffected.

Were you able to successfully deploy your functions?

Yes. For now I'm just reverting to 4.8.0 as it is the latest unaffected version.

@google-oss-bot
Copy link
Collaborator

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

@unxavi
Copy link

unxavi commented Mar 27, 2024

after updating to 4.8.1 I am seeing the same behavior with my project.

@dereekb just keep in mind that reverting to 4.8.0 can make your functions fail with the bug you attached, I am also seeing that in my project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants