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.

Not working in cloud function

See original GitHub issue

I am unable to get the client to work in a cloud function. Sometimes messages are never acknowledged (even though ack() is being called) and the cloud function can get “stuck” where no newly published messages are ever fetched until the cloud function is redeployed.

Reading the cloud function docs, background activities should not be started.

Is the node.js pubsub client not compatible with cloud functions because it sends acknowledgments in the background and re-uses connections from a pool? I have a StackOverflow question asking the same question in more detail.

Thanks!

Environment details

  • OS: Google Cloud Function
  • Node.js version: 6.11.5
  • npm version: not documented by Google
  • @google-cloud/pubsub version: 0.16.2

Steps to reproduce

  1. Create a Google Cloud Function using the pubsub client to pull messages from a subscription
  2. Deploy the function
  3. Publish messages, execute the function, and repeat

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:5
  • Comments:9

github_iconTop GitHub Comments

1reaction
0x-jjcommented, Feb 1, 2022

“Sometimes messages are never acknowledged (even though ack() is being called) and the cloud function can get “stuck” where no newly published messages are ever fetched until the cloud function is redeployed.”

I’m currently facing this exact same issue. Is it still the case that the nodejs library should not be used in this way? As it was a few years ago I wonder if there has since been a fix or I should use a different approach.

1reaction
codyzucommented, Feb 22, 2018

I wrote an article on our blog discussing in more detail why we use PubSub the way we do (and the challenges we encountered). It may be more clear than my description above.

Don’t hesitate to add any questions or feedback over there also…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshooting Cloud Functions - Google Cloud
Function deployment fails due to Cloud Build not supporting VPC-SC. Cloud Functions uses Cloud Build to build your source code into a runnable...
Read more >
android - Cloud Function Not Working - Stack Overflow
I want to add notifications to an online android chatting app I have made. I am new to cloud functions, ...
Read more >
Cloud function not working (Billing disabled, shutting down ...
Hello, My cloud function named sendFeedbackNotification is not working. Whenever I am trying to invocate it, I am getting this in log "Billing...
Read more >
Get started: write, test, and deploy your first functions - Firebase
To get started with Cloud Functions, try working through this tutorial, which starts with the required setup tasks and works through creating, testing, ......
Read more >
Google Cloud Functions and API key not working
I had past my last 8 hours, checking why api key restringion is not working at all. I will try to describe. Google...
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