question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Node 8 functions ending with "finished with status: 'connection error'"

See original GitHub issue

Firebase function triggered by firestore trigger is ending prematurely with finished with status: 'connection error'. There are no errors logged from actual function. Phase where function is exiting is varying. Most of the functions (lighter functions, with less communication to firestore) are finishing ok.

When runtime is changed to “Node.js 10 Beta” functions are working correctly.

Region: europe-west1 Memory allocated: 1 GB Timeout: 300 seconds

Related issues

#429 (already closed)

[REQUIRED] Version info

node: node 8 (in cloud) v12.4.0 (locally)

firebase-functions: “firebase-functions”: “3.3.0”

firebase-tools: “firebase-tools”: “7.12.1”

7.12.1

firebase-admin: “firebase-admin”: “8.9.1”

[REQUIRED] Test case

have not been able to extract code to reproduce it outside of my codebase. I have case where this is happening 100% of executions.

[REQUIRED] Steps to reproduce

Run function which is querying multiple documents from firestore using firebase-admin.

repo for reproducing issue: https://github.com/diginikkari/case00032967

Reproduction steps:

  1. create firestore project
  2. Initialize firestore database for project
  3. get service account credentials and save it root folder with name: service-account.json
  4. build and deploy functions npm run build; npm run deploy
  5. generate fake test data npm run generate-fake-data
  6. call function which add order document to firestore, which then triggers the firestore function trigger npm run create-order-copy
  7. check logs npm run logs

When function is using “node 8” it will end with finished with status: 'connection error'. When changing to “node 10” function is ending finished with status: 'ok'

[REQUIRED] Expected behavior

Function is finished succesfully.

[REQUIRED] Actual behavior

Function is ending prematurely with finished with status: 'connection error' message.

Were you able to successfully deploy your functions?

Yes, there were no errors with deployment.

log from errored execution.txt

log_screenshot

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:9
  • Comments:24

github_iconTop GitHub Comments

9reactions
c0rnonthec0bbcommented, Jan 21, 2020

We’re also experiencing this issue on a scheduled function that runs every minute. We first experienced the “connection error” result at 5:51pm PST on Jan 18th. As with the others in this thread, using the Node 10 Beta runtime fixes the issue, but that obviously is not an ideal solution.

9reactions
diginikkaricommented, Jan 19, 2020

@steven-tib I changed function runtime to node.js 10. This was desperate try because nothing else helped and for some reason it worked at least for me. So perhaps that is something you could try also.

I’m bit worried on using node.js 10 because it’s still in beta. But I figured that what I have to lose. I keep my functions in node 10 at least until this issue is solved.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cloud function finished with status: 'connection error' for large ...
The code in this post works well for both small and large files. The issue I faced was due to incorrect file. I...
Read more >
Cloud Functions: Functions Finished With 'Load Error' - ADocLib
node : node 8 (in cloud) v12.4.0 (locally) Function is ending prematurely with finished with status: 'connection error' message. Module not found: Can't...
Read more >
Write HTTP functions | Cloud Functions Documentation
In Node.js, you register an HTTP handler function with the Functions Framework ... If CORS is not set up properly, you might see...
Read more >
No traces when Function crashes - Node js runtime [155215191]
So when your code crashes, you can have the error displayed, and the lambda will (sadly) finish with an OK status. Message last...
Read more >
Protocol specification for https.onCall - Firebase - Google
This prevents coding errors from accidentally being exposed to end users. ... This means that if the function returns an explicit error with...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found