Skip to content
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

fix: stracktraces frames #190

Merged
merged 1 commit into from
Sep 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/edge-gateway/package.json
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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