You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to integrate with Sentry from my SvelteKit app that runs on cloudflare workers. Ideally I'd find a library that works when running in dev (i.e. npm run dev running in node) so I can try it out but also works when deployed in cloudflare workers. I don't think this is possible with any of the libraries, so I'm going to try to just get it to work when deployed in workers. I was planning on using toucan-js (https://github.com/punkeel/toucan-js). However this requires that I pass in the "workers fetch event" - the docs say that Toucan has to call the waitUntil method (https://developers.cloudflare.com/workers/runtime-apis/fetch-event#waituntil) - I assume so that it can reliably send the telemetry after the response has gone to the user.
I was wondering if there could be a way to expose features that are specific to the platform being run on like this - in my case I'm definitely targeting cloudflare so I'm okay being somewhat coupled to that platform? I wonder if it would make sense to make it possible for an adaptor to allow access to platform specific functionality and let the developer decide whether to couple to a specific platform or not, rather than force the lowest common denominator on everyone.
Describe the proposed solution
I would like to see an adaptor be able to make available provider specific options to the handle hook. I would then also like to see the cloudflare adapter provide this, although I'm using my own out of tree adapter (https://github.com/budgetdraw/sveltekit-cloudflare-adapter) so this is less relevant to me.
Alternatives considered
There is another sentry library targeting cloudflare workers:
I guess this might already be possible by adding extra key(s) to the request object outside the interface described in the documentation. If so perhaps what I'm asking for is an official way to do this
tomyan
pushed a commit
to budgetdraw/sveltekit-cloudflare-adapter
that referenced
this issue
Nov 17, 2021
This allows for use of the waitFor method on the fetch event, which
at present isn't possible (as far as I know) in the standard SvelteKit
API. See sveltejs/kit#2807.
Describe the problem
I'm trying to integrate with Sentry from my SvelteKit app that runs on cloudflare workers. Ideally I'd find a library that works when running in dev (i.e.
npm run dev
running in node) so I can try it out but also works when deployed in cloudflare workers. I don't think this is possible with any of the libraries, so I'm going to try to just get it to work when deployed in workers. I was planning on using toucan-js (https://github.com/punkeel/toucan-js). However this requires that I pass in the "workers fetch event" - the docs say that Toucan has to call thewaitUntil
method (https://developers.cloudflare.com/workers/runtime-apis/fetch-event#waituntil) - I assume so that it can reliably send the telemetry after the response has gone to the user.I was wondering if there could be a way to expose features that are specific to the platform being run on like this - in my case I'm definitely targeting cloudflare so I'm okay being somewhat coupled to that platform? I wonder if it would make sense to make it possible for an adaptor to allow access to platform specific functionality and let the developer decide whether to couple to a specific platform or not, rather than force the lowest common denominator on everyone.
Describe the proposed solution
I would like to see an adaptor be able to make available provider specific options to the
handle
hook. I would then also like to see the cloudflare adapter provide this, although I'm using my own out of tree adapter (https://github.com/budgetdraw/sveltekit-cloudflare-adapter) so this is less relevant to me.Alternatives considered
There is another sentry library targeting cloudflare workers:
https://github.com/cfworker/cfworker/blob/main/packages/sentry/README.md
This also suggests using
FetchEvent.waitUntil
.I also noticed that the SvelteKit docs include a Sentry example:
https://kit.svelte.dev/docs#hooks-handleerror
However, I assume this is using the
@sentry/node
package (https://www.npmjs.com/package/@sentry/node), which wouldn't work (I don't think) when deployed to a worker.Importance
would make my life easier
Additional Information
No response
The text was updated successfully, but these errors were encountered: