firebase-tools: Function timed out in v11.3.0-11.4.1

[REQUIRED] Environment info

firebase-tools: 11.4.1

Platform: Linux Mint 20.3

[REQUIRED] Test case

$firebase serve
i  functions: Beginning execution of "helloWorld"
⚠  functions: Your function timed out after ~60s. To configure this timeout, see
      https://firebase.google.com/docs/functions/manage-functions#set_timeout_and_memory_allocation.
>  /usr/lib/node_modules/firebase-tools/lib/emulator/functionsEmulatorRuntime.js:635
>              throw new Error("Function timed out.");
>              ^
>  
>  Error: Function timed out.
>      at Timeout._onTimeout (/usr/lib/node_modules/firebase-tools/lib/emulator/functionsEmulatorRuntime.js:635:19)
>      at listOnTimeout (node:internal/timers:559:17)
>      at processTimers (node:internal/timers:502:7)

In v. 11.2.2 function work

[REQUIRED] Steps to reproduce

My func code

exports.helloWorld = functions.https.onRequest((request, response) => {
  functions.logger.info("Hello logs!", {structuredData: true});
  response.send("Hello from Firebase!");
});

[REQUIRED] Expected behavior

[REQUIRED] Actual behavior

[2022-08-01T22:52:43.028Z] [worker-pool] addWorker(us-central1-helloWorld) {"metadata":{"emulator":{"name":"functions"},"message":"[worker-pool] addWorker(us-central1-helloWorld)"}}
[2022-08-01T22:52:43.036Z] [worker-pool] Adding worker with key us-central1-helloWorld, total=2 {"metadata":{"emulator":{"name":"functions"},"message":"[worker-pool] Adding worker with key us-central1-helloWorld, total=2"}}
[2022-08-01T22:52:43.040Z] [worker-pool] submitWork(triggerId=us-central1-helloWorld) {"metadata":{"emulator":{"name":"functions"},"message":"[worker-pool] submitWork(triggerId=us-central1-helloWorld)"}}
[2022-08-01T22:52:43.051Z] [worker-us-central1-helloWorld-4fc8b443-9aca-4ea2-8257-d0eeb92e69b0]: BUSY {"metadata":{"emulator":{"name":"functions"},"message":"[worker-us-central1-helloWorld-4fc8b443-9aca-4ea2-8257-d0eeb92e69b0]: BUSY"}}
FirebaseError: Failed to load function.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 7
  • Comments: 32 (11 by maintainers)

Commits related to this issue

Most upvoted comments

This issue does not have all the information required by the template. Looks like you forgot to fill out some sections. Please update the issue with more information.

This issue does not have all the information required by the template. Looks like you forgot to fill out some sections. Please update the issue with more information.

this issue is happening with me too. this issue started after the new update too. I am suffering a lot with this problem. my firebase-tools version is 11.4.1 too.

the issue is happening exactly the same way as this user. This is hampering all my development, causing my websites to have several gateway errors, loading incompletely. i was forced to revert to a previous version

Thanks everyone for your responses! It’s encouraging to hear that things are working better now that we’ve released some large refactors on the Functions Emulators, though I’m a bit puzzled and disappointed that I never go to understand what exactly was happening that affected many of your setups.

I’m going to close this issue. If anyone is experiencing similar issue, please feel free to open up a new ticket!

Hey @absemetov. We need more information to resolve this issue but there hasn’t been an update in 7 weekdays. I’m marking the issue as stale and if there are no new updates in the next 3 days I will close it automatically.

If you have more information that will help us get to the bottom of this, just add a comment!

Only downgrade to firebase-tools@11.2.2 has helped to me !

I get timeout error when the NodeJS version is >= 15. downgrading the NodeJS or the firebase resolved the issue. If you want to use latest version of firebase use NodeJS < 15 or if you want to use latest version of NodeJS, downgrade firebase to 11.2.2

I’m experiencing the same timeout issue at version 11.5.0. Downgrading to 11.2.2 fixes the issue for me.

@taeold I booted my old laptop today since I saw that some refactoring had happened in recent versions. I updated to 11.10.0 and no longer get the timeouts. Thanks!

I just tried my simple repro at v11.9.0 and it appears to be working correctly!

Just to be sure, I downgraded to v11.6 and verified that it was still broken. So v11.9.0 seems to me to have resolved the issue for me! I’m not sure if there was an intentional fix committed between these two versions or not.

Thanks for the awesome project!

Just for reference: macOS 12.6 Intel processor node: v16.17.0

Problem solved. Thanks! node: v16.17.0 OS: Linux Mint 21

I just tried my simple repro at v11.9.0 and it appears to be working correctly!

Just to be sure, I downgraded to v11.6 and verified that it was still broken. So v11.9.0 seems to me to have resolved the issue for me! I’m not sure if there was an intentional fix committed between these two versions or not.

Thanks for the awesome project!

Just for reference: macOS 12.6 Intel processor node: v16.17.0

I have the same issues…sooooo annoying

Going back to “firebase-tools”: “^11.2.2” works like a charm. Blasting fast in my emulator

You can generate the debug log with following command

@taeold is there a way for me to share this log file privately with you? email?

@rawatnaresh @ottob Thanks for more info. I will try my best to reproduce the error on my side.

For folks coming across this issue - the best workaround so far is to downgrade your Firebase CLI to 11.2.2:

npm i -g firebase-tootls@11.2.2

Apologies for the invconveniene.

I get timeout error when the NodeJS version is >= 15. downgrading the NodeJS or the firebase resolved the issue. If you want to use latest version of firebase use NodeJS < 15 or if you want to use latest version of NodeJS, downgrade firebase to 11.2.2

I tried to change the version of node js, I still have the problem

@bobbydreamer Based on what I read from your stackoverflow question and your logs, I think the “timeout” issue you are seeing is a different problem. Specifically, I think this error message you are seeing:

[debug] FirebaseError: Failed to load function.
    at Timeout._onTimeout (C:\Users\Sushanth\AppData\Roaming\npm\node_modules\firebase-tools\lib\emulator\functionsRuntimeWorker.js:104:24)
    at listOnTimeout (node:internal/timers:559:17)
    at processTimers (node:internal/timers:502:7) {"metadata":{"emulator":{"name":"functions"},"message":{"name":"FirebaseError","children":[],"exit":1,"message":"Failed to load function.","status":500}}}

This means that your application server couldn’t be started within ~7 seconds 🤔. If you open up a new issue, I’ll follow up with more detail there.

@rawatnaresh Thanks for the clue here. Do you mind sharing your application setup a little more? I’m beginning to see a pattern where it takes more than ~7seconds for the Functions Emulator to load and startup an internal server to respond to HTTP requests, and I’m wondering if your code has logic at startup that is long running.