-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Not Working with Cloudflare workers: dist.init is not a function #1665
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
Comments
I'm aware of https://blog.cloudflare.com/dogfooding-edge-workers/ but I was hoping to use the standard sentry sdk. |
I've updated the code to log errors to sentry directly and that's working fine. If you want to replicate the error you'll need to use this commit which actually uses raven-js and edit from there, I don't have a commit with |
How does your |
I think you mean Here's my code: import * as Sentry from '@sentry/minimal'
import {Request, router} from './src/utils'
import test from './src/test'
Sentry.init({dsn: process.env.RAVEN_DSN})
const routes = {
default: test
}
async function handle_request(raw_request) {
const request = new Request(raw_request)
await request.prepare()
Sentry.captureMessage(`request ${request.url}`, {extra: {request: request.debug_info()}})
try {
const handler = router(routes)
return handler(event.request)
} catch (e) {
Sentry.captureException(e)
}
}
addEventListener('fetch', event => {
event.respondWith(handle_request(event.request))
}) And here's a branch with that code on it. And here's a worker preview with that code running. |
Just to confirm, personally I don't need this anymore as I spent Friday afternoon ignoring my real work and building my own sentry logger which plays nicely with web worker's |
(and let's me include |
You can write your own |
would that solve the |
No, but I |
The initially reported issue is resolved I guess, so let me close it. Feel free to ping me if this still needs to be reopened. Cheers! |
To handle errors occuring offline in JavaScript this integration saves them in a queue and processes these queued up errors when back online. As a storage API localForage (https://github.com/localForage/localForage) is used. A new function listens to the 'online' event to start draining the queue. I am missing correct error handling and tests. Also Im not sure about the correct way to include the interation to sdk.ts. Building .min and .es6 files is also not working with 'yarn build'. Minifing with uglyfy works. Thanks especially to @kamilogorek and @ seromenho Resolves: getsentry#1633 See also: getsentry#1665 getsentry#279
To handle errors occuring offline in JavaScript this integration saves them in a queue and processes these queued up errors when back online. As a storage API localForage (https://github.com/localForage/localForage) is used. A new function listens to the 'online' event to start draining the queue. I am missing correct error handling and tests. Also I am not sure about the correct way to include the interation to sdk.ts. Building .min and .es6 files is also not working with 'yarn build'. Minifing with uglify-js works. Thanks especially to @kamilogorek and @ seromenho Resolves: getsentry#1633 See also: getsentry#1665 getsentry#279
To handle errors occuring offline in JavaScript this integration saves them in a queue and processes these queued up errors when back online. As a storage API localForage (https://github.com/localForage/localForage) is used. A new function listens to the 'online' event to start draining the queue. I am missing correct error handling and tests. Also I am not sure about the correct way to include the interation to sdk.ts. Building .min and .es6 files is also not working with 'yarn build'. Minifing with uglify-js works. Thanks especially to @kamilogorek and @ seromenho Resolves: getsentry#1633 See also: getsentry#1665 getsentry#279
@samuelcolvin - this project might be of interest to you: https://github.com/tlianza/pigeon - I wrote it while trying to solve what sounds like the same problem. |
@tlianza nicely done! Love that someone used our custom client/backend architecture :) |
I can fix the referrerPolicy issue by commenting out that line in fetch call. There are still various issues with the SDK on Workers though. |
FYI I'd recommend this library these days: https://github.com/robertcepa/toucan-js |
Uh oh!
There was an error while loading. Please reload this page.
Package + Version
@sentry/minimal
@sentry/browser
raven-js
Version:
Description
I'm trying to use Sentry's javascript SDK with cloudflare workers, however I'm getting an error using either
@sentry/minimal
,@sentry/browser
orraven-js
.The code is at available at https://github.com/tutorcruncher/cloudflare-worker and a preview is avilable at https://cloudflareworkers.com/#8dc47c7e9bd4a5463e6495630f82b7e9:https://workers.tutorcruncher.com although I'm not sure how long that will last for.
If the preview has stopped working you should be able to run a new preview with simply
yarn && python preview.py
.I also tried
@sentry/browser
but an errorThe 'referrerPolicy' field on 'RequestInitializerDict' is not implemented.
which makes sense.raven-js
gave yet another error.The text was updated successfully, but these errors were encountered: