GoogleCloudPlatform / functions-framework-nodejs

FaaS (Function as a service) framework for writing portable Node.js functions
Apache License 2.0
1.29k stars 158 forks source link

Gen 1 `PubSub` Cloud Function is hanging in local development #496

Closed nikodraca closed 10 months ago

nikodraca commented 1 year ago

I have a handler that looks like this:

import {Context} from '@google-cloud/functions-framework/build/src/functions';
import {PubsubMessage} from '@google-cloud/pubsub/build/src/publisher';

exports['handle-add-track-to-playlist'] = async (
  event: PubsubMessage,
  context: Context
): Promise<any> => {
  // do stuff...

  return
}

but when running locally with functions-framework --source=MY_SOURCE --target=MY_TARGET the function executes and then hangs indefinitely. Is there a proper way to finish the execution? I noticed there's no callback() parameter or something like res.json() in HTTP functions, so not sure what to do other than return.

kenneth-rosario commented 11 months ago

Hey @nikodraca

Are you still facing this issue?

If so, can you provide a minimal reproduction containing the // do stuff... section. The body of the minimal reproduction function should be as close as possible to what you are doing in your code. It would also be helpful to include the curl command that causes your function to hang in order to troubleshoot the issue.

Thanks