Skip to content

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

Closed
@dereekb

Description

@dereekb

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions