Closed
Description
Is there an existing issue for this?
- I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues
- I have reviewed the documentation https://docs.sentry.io/
- I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases
How do you use Sentry?
Sentry Saas (sentry.io)
Which package are you using?
@sentry/serverless
SDK Version
7.11.1
Framework Version
No response
Link to Sentry event
Steps to Reproduce
- Set up a GCP PubSub function with a handler function that does not have the optional callback argument.
export const rawHandler: EventFunction = async (
message: PubsubMessage,
context: CloudEventsContext
): Promise<void> => {
}
- Wrap your handler function in sentry
export const handler = Sentry.GCPFunction.wrapEventFunction(rawHandler);
- Run your function
Expected Result
No error is thrown
Actual Result
A TypeError: callback is not a function
error is thrown after the handler function has finished executing.
This is the offending line of code https://github.com/getsentry/sentry-javascript/blob/master/packages/serverless/src/gcpfunction/events.ts#L65. It invokes a callback without checking if it exists first.
Metadata
Metadata
Assignees
Labels
No labels