Title: `wrapCloudEventFunction` incompatible with `CloudEvent` type from Google Cloud functions framework · Issue #16653 · getsentry/sentry-javascript · GitHub
Open Graph Title: `wrapCloudEventFunction` incompatible with `CloudEvent` type from Google Cloud functions framework · Issue #16653 · getsentry/sentry-javascript
X Title: `wrapCloudEventFunction` incompatible with `CloudEvent` type from Google Cloud functions framework · Issue #16653 · getsentry/sentry-javascript
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/...
Open Graph 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 th...
X 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 th...
Opengraph URL: https://github.com/getsentry/sentry-javascript/issues/16653
X: @github
Domain: github.com
IPv4 address: 140.82.114.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"`wrapCloudEventFunction` incompatible with `CloudEvent` type from Google Cloud functions framework","articleBody":"### Is there an existing issue for this?\n\n- [x] I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues\n- [x] I have reviewed the documentation https://docs.sentry.io/\n- [x] I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases\n\n### How do you use Sentry?\n\nSentry Saas (sentry.io)\n\n### Which SDK are you using?\n\n@sentry/google-cloud-serverless\n\n### SDK Version\n\n9.30.0\n\n### Framework Version\n\n@sentry/google-cloud-serverless@9.30.0\n\n### Link to Sentry event\n\n_No response_\n\n### Reproduction Example/SDK Setup\n\n```javascript\nimport * as Sentry from \"@sentry/google-cloud-serverless\";\nimport { type CloudEvent } from \"@google-cloud/functions-framework\";\nSentry.wrapCloudEventFunction(async (cloudevent: CloudEvent\u003cany>) => {});\n```\n\n### Steps to Reproduce\n\n1. Install `@google-cloud/functions-framework@4.0.0`, `typescript@5.8.3` and `@sentry/google-cloud-serverless@9.30.0`\n2. Paste repro script\n3. Run `tsc --noEmit`, strict mode enabled\n\nWorth noting here is that `functions-framework@4.0.0` installs `\"cloudevents\": \"^8.0.2\"`\n\n### Expected Result\n\nNo typechecking errors\n\n### Actual Result\n\n```\n> tsc --noEmit\n\nindex.ts:30:31 - error TS2345: Argument of type '(cloudevent: CloudEvent\u003cany>) => Promise\u003cvoid>' is not assignable to parameter of type 'CloudEventFunction | CloudEventFunctionWithCallback'.\n Type '(cloudevent: CloudEvent\u003cany>) => Promise\u003cvoid>' is not assignable to type 'CloudEventFunction'.\n Types of parameters 'cloudevent' and 'cloudevent' are incompatible.\n Type 'CloudEventsContext' is not assignable to type 'CloudEventV1\u003cany>'.\n Types of property 'id' are incompatible.\n Type 'string | undefined' is not assignable to type 'string'.\n Type 'undefined' is not assignable to type 'string'.\n\n30 Sentry.wrapCloudEventFunction(async (cloudevent: CloudEvent\u003cany>) => {});\n ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n```\n\nTo rephrase the error message; problem is that attributes of the `CloudEventsContext` interface from Sentry are not matching with the `CloudEvent` interface from Google's functions framework package, where `CloudEvent` is reexported from [cloudevents](https://github.com/cloudevents/sdk-javascript).\n\n`CloudEventsContext` from Sentry: https://github.com/getsentry/sentry-javascript/blob/b94f65279c8341a7176fe68186feef58af57e2cb/packages/google-cloud-serverless/src/gcpfunction/general.ts#L30-L39\n\nvs. `CloudEvent` from functions framework (via `cloudevents`) (ref: https://github.com/cloudevents/sdk-javascript/blob/c07afa9b774deefa137a960d2d11adee0bf3674a/src/event/interfaces.ts#L10-L31):\n\n```javascript\nexport interface CloudEventV1\u003cT> extends CloudEventV1Attributes\u003cT> {\n // REQUIRED Attributes\n /**\n * [REQUIRED] Identifies the event. Producers MUST ensure that `source` + `id`\n * is unique for each distinct event. If a duplicate event is re-sent (e.g. due\n * to a network error) it MAY have the same `id`. Consumers MAY assume that\n * Events with identical `source` and `id` are duplicates.\n * @required Non-empty string. Unique within producer.\n * @example An event counter maintained by the producer\n * @example A UUID\n */\n id: string;\n\n /**\n * [REQUIRED] The version of the CloudEvents specification which the event\n * uses. This enables the interpretation of the context. Compliant event\n * producers MUST use a value of `1.0` when referring to this version of the\n * specification.\n * @required MUST be a non-empty string.\n */\n specversion: string;\n}\n```","author":{"url":"https://github.com/flaeppe","@type":"Person","name":"flaeppe"},"datePublished":"2025-06-19T08:56:41Z","url":"https://github.com/getsentry/sentry-javascript/issues/16653"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:ab59e7c5-3ebe-fefc-03cc-9b087b5cb281 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9E28:3F189D:39A322:4B73DD:6B07652F |
| html-safe-nonce | 28df8d116c612817eb670dab5dcf2faf32eedf5af45a91decff6ffed5dbd449e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5RTI4OjNGMTg5RDozOUEzMjI6NEI3M0REOjZCMDc2NTJGIiwidmlzaXRvcl9pZCI6Ijc2MjIxNjM1MjAwOTIwNzEyMTUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | b620af4babc5c2eb77be10ef1ba3adf51e3687abb6a3442cfa0de95a16d1d626 |
| hovercard-subject-tag | issue:3159527265 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/getsentry/sentry-javascript/16653/issue_layout |
| twitter:image | https://opengraph.githubassets.com/c4041336279f7022be4c8c0b624c6d0dd27014eab669548511a793e3a076ab26/getsentry/sentry-javascript/issues/16653 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/c4041336279f7022be4c8c0b624c6d0dd27014eab669548511a793e3a076ab26/getsentry/sentry-javascript/issues/16653 |
| og:image:alt | 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 th... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | flaeppe |
| hostname | github.com |
| expected-hostname | github.com |
| None | 7a557ecc960a3ae6e299fc66b0bc9132072f8860191648e6749fee5d3ff00d82 |
| turbo-cache-control | no-preview |
| go-import | github.com/getsentry/sentry-javascript git https://github.com/getsentry/sentry-javascript.git |
| octolytics-dimension-user_id | 1396951 |
| octolytics-dimension-user_login | getsentry |
| octolytics-dimension-repository_id | 3328572 |
| octolytics-dimension-repository_nwo | getsentry/sentry-javascript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 3328572 |
| octolytics-dimension-repository_network_root_nwo | getsentry/sentry-javascript |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | bd845eb7947c1ed8c850f7ab415a51339d162de3 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width