Skip to content

Commit

Permalink
fix: stracktraces frames (#190)
Browse files Browse the repository at this point in the history
  • Loading branch information
vasco-santos committed Sep 8, 2022
1 parent 71cf16f commit 99221ba
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 12 deletions.
4 changes: 2 additions & 2 deletions packages/edge-gateway/package.json
Expand Up @@ -4,10 +4,10 @@
"description": "IPFS edge gateway for nft.storage",
"private": true,
"type": "module",
"main": "./dist/worker.mjs",
"main": "./dist/worker.js",
"scripts": {
"build": "node scripts/cli.js build",
"dev": "miniflare --watch --debug",
"dev": "miniflare dist/worker.js --watch --debug -m",
"deploy": "wrangler publish --env production",
"test": "npm run test:setup && npm run test:worker",
"test:worker": "ava --verbose test/*.spec.js",
Expand Down
4 changes: 2 additions & 2 deletions packages/edge-gateway/scripts/build.js
Expand Up @@ -23,7 +23,7 @@ export async function buildCmd(opts) {
entryPoints: [path.join(__dirname, '..', 'src', 'index.js')],
bundle: true,
format: 'esm',
outfile: path.join(__dirname, '..', 'dist', 'worker.mjs'),
outfile: path.join(__dirname, '..', 'dist', 'worker.js'),
legalComments: 'external',
define: {
SENTRY_RELEASE: JSON.stringify(sentryRelease),
Expand Down Expand Up @@ -53,7 +53,7 @@ export async function buildCmd(opts) {
})
await cli.releases.uploadSourceMaps(sentryRelease, {
include: [path.join(__dirname, '..', 'dist')],
ext: ['map', 'mjs'],
ext: ['map', 'js'],
})
await cli.releases.finalize(sentryRelease)
await cli.releases.newDeploy(sentryRelease, {
Expand Down
8 changes: 2 additions & 6 deletions packages/edge-gateway/src/env.js
Expand Up @@ -63,12 +63,8 @@ function getSentry(request, env, ctx) {
debug: false,
environment: env.ENV || 'dev',
rewriteFrames: {
// strip . from start of the filename ./worker.mjs as set by cloudflare, to make absolute path `/worker.mjs`
iteratee: (frame) => ({
...frame,
// @ts-ignore
filename: frame.filename.substring(1),
}),
// sourcemaps only work if stack filepath are absolute like `/worker.js`
root: '/',
},
release: env.SENTRY_RELEASE,
pkg,
Expand Down
2 changes: 1 addition & 1 deletion packages/edge-gateway/test/utils/miniflare.js
Expand Up @@ -11,7 +11,7 @@ export function getMiniflare() {

return new Miniflare({
envPath,
scriptPath: 'dist/worker.mjs',
scriptPath: 'dist/worker.js',
port: 8788,
packagePath: true,
wranglerConfigPath: true,
Expand Down
2 changes: 1 addition & 1 deletion packages/edge-gateway/wrangler.toml
@@ -1,6 +1,6 @@
# nftstorage.link wrangler config.
name = "gateway-nft-storage"
main = "./dist/worker.mjs"
main = "./dist/worker.js"
compatibility_date = "2022-07-01"
compatibility_flags = [ "url_standard" ]
no_bundle = true
Expand Down

0 comments on commit 99221ba

Please sign in to comment.