Open worenga opened 4 years ago
How do I repro?
Create a rollup.config.js with the following:
// rollup.config.js
import nodeResolve from '@rollup/plugin-node-resolve';
import commonJS from '@rollup/plugin-commonjs';
let outfile = 'dist/worker.js';
let defaults = {
input: 'src/main.js',
output: {
file: outfile,
format: 'iife',
compact: true,
preferConst: true,
sourcemap: true,
},
plugins: [
commonJS({
namedExports: {
lru_map: ['LRUMap']
},
include: 'node_modules/**',
extensions: ['.js']
}),
nodeResolve({})
]
};
export default defaults;
src/main.js:
import * as Pigeon from "pigeon";
addEventListener('fetch', event => {
Pigeon.init({
dsn: "https://nananananbatman@sentry.io/batman",
event: event
});
/**
* In the event of an uncaught exception, fail-open as if the worker did not exist
*/
event.passThroughOnException();
event.respondWith(handleRequest(event));
});
async function handleRequest(event) {
const request = event.request;
Pigeon.captureException(new Error("Test123"));
return new Response('meh')
}
error when running rollup:
src/main.js → dist/worker.js...
(!) Import of non-existent exports
node_modules/pigeon/pigeon-backend.js
9: } from "@sentry/utils";
10:
11: import { StackFrame, Status } from "@sentry/types"
^
12: import * as stacktrace from 'stack-trace'
node_modules/pigeon/cf-workers-sentry.js
1: import PigeonBackend from './pigeon-backend'
2: import { getCurrentHub, initAndBind, BaseClient } from '@sentry/core';
3: import { Request } from '@sentry/types';
^
4:
5: export const SDK_NAME = 'cf-workers';
While you should move to toucan-js, if you need a temporary quick fix for this, you can add the following to your package.json
:
"overrides": {
"@tlianza/pigeon": {
"@sentry/core": "5.6.1",
"@sentry/hub": "5.6.1",
"@sentry/minimal": "5.6.1",
"@sentry/types": "5.6.1",
"@sentry/utils": "5.6.1"
}
}
The latest Sentry version I could get to work was 5.6.1 when patching some issues temporarily on an old project.