Title: Sentry Serverless types do not work with Firebase background functions · Issue #3269 · getsentry/sentry-javascript · GitHub
Open Graph Title: Sentry Serverless types do not work with Firebase background functions · Issue #3269 · getsentry/sentry-javascript
X Title: Sentry Serverless types do not work with Firebase background functions · Issue #3269 · getsentry/sentry-javascript
Description: Package + Version @sentry/serverless 6.2.0 Description Firebase offers a few extra types of cloud functions that do not implement the same interface as the existing GCPFunction options. It seems like these work as expected but the typing...
Open Graph Description: Package + Version @sentry/serverless 6.2.0 Description Firebase offers a few extra types of cloud functions that do not implement the same interface as the existing GCPFunction options. It seems li...
X Description: Package + Version @sentry/serverless 6.2.0 Description Firebase offers a few extra types of cloud functions that do not implement the same interface as the existing GCPFunction options. It seems li...
Opengraph URL: https://github.com/getsentry/sentry-javascript/issues/3269
X: @github
Domain: github.com
IPv4 address: 140.82.114.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Sentry Serverless types do not work with Firebase background functions","articleBody":"## Package + Version\r\n\r\n`@sentry/serverless`\r\n\r\n`6.2.0`\r\n\r\n## Description\r\n\r\nFirebase offers a few extra types of cloud functions that do not implement the same interface as the existing GCPFunction options. It seems like these work as expected but the typings do not allow a typescript project to compile. \r\n\r\nPrimarily the ones I am most interested today are the [Cloud Firestore triggers](https://firebase.google.com/docs/functions/firestore-events) and [Authentication triggers](https://firebase.google.com/docs/functions/auth-events). The remaining can be found in the docs: https://firebase.google.com/docs/functions/firestore-event\r\n\r\nHere are some examples:\r\n\r\n```typescript\r\nconst thingCreateHandler = (snap, context) => {}\r\n\r\nexport const thingCreated = functions.firestore\r\n .document('things/{id}')\r\n .onCreate(Sentry.GCPFunction.wrapEventFunction(thingCreateHandler))\r\n```\r\n\r\n> Argument of type 'EventFunctionWithCallback' is not assignable to parameter of type '(snapshot: QueryDocumentSnapshot, context: EventContext) => any'.ts(2345)\r\n\r\n```typescript\r\nconst userCreateHandler = (user, context) => {}\r\n\r\nexport const userCreate = functions.auth.user().onCreate(\r\n Sentry.GCPFunction.wrapEventFunction(userCreateHandler)\r\n);\r\n```\r\n\r\n> Argument of type 'EventFunctionWithCallback' is not assignable to parameter of type '(user: UserRecord, context: EventContext) => any'.ts(2345)\r\n\r\n\r\n\r\nThis is what the interface looks like:\r\n\r\n- Cloud Firestore Triggers: \r\n```typescript\r\n /** Respond to all document writes (creates, updates, or deletes). */\r\n onWrite(handler: (change: Change\u003cDocumentSnapshot>, context: EventContext) => PromiseLike\u003cany> | any): CloudFunction\u003cChange\u003cDocumentSnapshot>>;\r\n /** Respond only to document updates. */\r\n onUpdate(handler: (change: Change\u003cQueryDocumentSnapshot>, context: EventContext) => PromiseLike\u003cany> | any): CloudFunction\u003cChange\u003cQueryDocumentSnapshot>>;\r\n /** Respond only to document creations. */\r\n onCreate(handler: (snapshot: QueryDocumentSnapshot, context: EventContext) => PromiseLike\u003cany> | any): CloudFunction\u003cQueryDocumentSnapshot>;\r\n /** Respond only to document deletions. */\r\n onDelete(handler: (snapshot: QueryDocumentSnapshot, context: EventContext) => PromiseLike\u003cany> | any): CloudFunction\u003cQueryDocumentSnapshot>;\r\n```\r\n\r\n- Authentication Triggers:\r\n\r\n```typescript\r\n /** Respond to the creation of a Firebase Auth user. */\r\n onCreate(handler: (user: UserRecord, context: EventContext) => PromiseLike\u003cany> | any): CloudFunction\u003cUserRecord>;\r\n /** Respond to the deletion of a Firebase Auth user. */\r\n onDelete(handler: (user: UserRecord, context: EventContext) => PromiseLike\u003cany> | any): CloudFunction\u003cUserRecord>;\r\n```\r\n","author":{"url":"https://github.com/jsakas","@type":"Person","name":"jsakas"},"datePublished":"2021-02-18T22:39:57Z","url":"https://github.com/getsentry/sentry-javascript/issues/3269"}
| 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:2668dc33-1145-0184-8a7e-35e4853a18ba |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B96E:27570E:42A669:5B442B:6B04BF35 |
| html-safe-nonce | 90e5eba7d1ba46e9e27ba82d9c18f4cb96f78bfac3fc88652d79c3a746788f49 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCOTZFOjI3NTcwRTo0MkE2Njk6NUI0NDJCOjZCMDRCRjM1IiwidmlzaXRvcl9pZCI6IjUxOTEwMTk4NTY1MzkyMDU0MjkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | a84bd6da62672d3648612df8e4495810cc24e1656622279b4f52c5fa7d11c1b8 |
| hovercard-subject-tag | issue:811528324 |
| 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/3269/issue_layout |
| twitter:image | https://opengraph.githubassets.com/3c6f75f8b6d41836bd42be5d6ddc2e6976570ad0bf8b87506cba75691d37c2cb/getsentry/sentry-javascript/issues/3269 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/3c6f75f8b6d41836bd42be5d6ddc2e6976570ad0bf8b87506cba75691d37c2cb/getsentry/sentry-javascript/issues/3269 |
| og:image:alt | Package + Version @sentry/serverless 6.2.0 Description Firebase offers a few extra types of cloud functions that do not implement the same interface as the existing GCPFunction options. It seems li... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | jsakas |
| hostname | github.com |
| expected-hostname | github.com |
| None | 85dd75377eb77313206b8fc108bcee6a3a029286d94bf32bf9b4426e4d92e0c4 |
| 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 | 0d64fa748a2bab9a5b587a967ac4da1cfa8da6dd |
| 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