Sentry middleware: fix undefined DSN environment variable error (#89)
* Use optional chaining for determining Sentry DSN from environment * Bump Hono version for Sentry middleware * Fix tests on Deno * Add changeset for Sentry middleware patch * Denoify the new Sentry patchpull/88/head
parent
b7fe359dbc
commit
963b1ac0de
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
'@hono/sentry': patch
|
||||
---
|
||||
|
||||
Use optional chaining for determining Sentry DSN from environment (#89)
|
|
@ -41,7 +41,7 @@ export const sentry = (
|
|||
hasExecutionContext = false
|
||||
}
|
||||
const sentry = new Toucan({
|
||||
dsn: c.env.SENTRY_DSN ?? c.env.NEXT_PUBLIC_SENTRY_DSN,
|
||||
dsn: c.env?.SENTRY_DSN ?? c.env?.NEXT_PUBLIC_SENTRY_DSN,
|
||||
allowedHeaders: ['user-agent'],
|
||||
allowedSearchParams: /(.*)/,
|
||||
request: c.req.raw,
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
export { assert, assertEquals } from 'https://deno.land/std@0.148.0/testing/asserts.ts'
|
||||
export { Hono } from 'https://deno.land/x/hono@v2.6.1/mod.ts'
|
||||
export { Hono } from 'https://deno.land/x/hono@v3.2.3/mod.ts'
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
"access": "public"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"hono": "^3.0.2"
|
||||
"hono": "^3.2.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"toucan-js": "^2.6.1"
|
||||
|
@ -61,4 +61,4 @@
|
|||
"ts-jest": "^28.0.5",
|
||||
"typescript": "^4.7.4"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ export const sentry = (
|
|||
hasExecutionContext = false
|
||||
}
|
||||
const sentry = new Toucan({
|
||||
dsn: c.env.SENTRY_DSN ?? c.env.NEXT_PUBLIC_SENTRY_DSN,
|
||||
dsn: c.env?.SENTRY_DSN ?? c.env?.NEXT_PUBLIC_SENTRY_DSN,
|
||||
allowedHeaders: ['user-agent'],
|
||||
allowedSearchParams: /(.*)/,
|
||||
request: c.req.raw,
|
||||
|
|
Loading…
Reference in New Issue