Skip to content

fix(serverless): Check for existence of callback in GCP event handler before calling #5608

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 19, 2022

Conversation

lforst
Copy link
Contributor

@lforst lforst commented Aug 19, 2022

Fixes: #5607

This PR adds a check if a callback is provided to the GCP Events handler function before calling it. Additionally, it adjusts the types of the function so we would have caught this.

@lforst lforst requested review from Lms24 and AbhiPrasad August 19, 2022 11:31
wrapOptions: Partial<EventFunctionWrapperOptions> = {},
): EventFunctionWithCallback {
): (...args: Parameters<F>) => ReturnType<F> | Promise<void> {
Copy link
Contributor Author

@lforst lforst Aug 19, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, we cannot just do F here since it produces some weird TS error I don't know how to fix.

@github-actions
Copy link
Contributor

size-limit report 📦

Path Size
@sentry/browser - ES5 CDN Bundle (gzipped + minified) 19.4 KB (-0.02% 🔽)
@sentry/browser - ES5 CDN Bundle (minified) 60.06 KB (0%)
@sentry/browser - ES6 CDN Bundle (gzipped + minified) 17.98 KB (0%)
@sentry/browser - ES6 CDN Bundle (minified) 52.92 KB (0%)
@sentry/browser - Webpack (gzipped + minified) 19.77 KB (0%)
@sentry/browser - Webpack (minified) 64.31 KB (0%)
@sentry/react - Webpack (gzipped + minified) 19.79 KB (0%)
@sentry/nextjs Client - Webpack (gzipped + minified) 44.72 KB (0%)
@sentry/browser + @sentry/tracing - ES5 CDN Bundle (gzipped + minified) 25.91 KB (-0.01% 🔽)
@sentry/browser + @sentry/tracing - ES6 CDN Bundle (gzipped + minified) 24.28 KB (-0.02% 🔽)

Copy link
Member

@Lms24 Lms24 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good Fix!

@lforst lforst merged commit 0bb0092 into master Aug 19, 2022
@lforst lforst deleted the lforst-fix-gcp-event-handler branch August 19, 2022 12:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TypeError: callback is not a function thrown by Sentry.GCPFunction.wrapEventFunction
2 participants