-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed as not planned
Closed as not planned
Copy link
Labels
Description
Is there an existing issue for this?
- I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues
- I have reviewed the documentation https://docs.sentry.io/
- I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases
How do you use Sentry?
Sentry Saas (sentry.io)
Which SDK are you using?
@sentry/cloudflare
SDK Version
10.45.0
Framework Version
wrangler 4.75.0
Link to Sentry event
No response
Reproduction Example/SDK Setup
export default Sentry.withSentry(
(env: Env) => ({
dsn: env.SENTRY_DSN.get(), // SENTRY_DSN is a SecretsStoreSecret, .get() returns a Promise<string>
tracesSampleRate: 1.0,
enableLogs: true,
sendDefaultPii: true,
}),
{
fetch: app.fetch
} satisfies ExportedHandler<Env>,
);Sentry.withSentry() doesn't handle promises. link
export function withSentry<
Env = typeof env,
QueueHandlerMessage = unknown,
CfHostMetadata = unknown,
T extends ExportedHandler<Env, QueueHandlerMessage, CfHostMetadata> = ExportedHandler<
Env,
QueueHandlerMessage,
CfHostMetadata
>,
>(optionsCallback: (env: Env) => CloudflareOptions | undefined, handler: T): T {
setAsyncLocalStorageAsyncContextStrategy();
try {
instrumentExportedHandlerFetch(handler, optionsCallback);
instrumentHonoErrorHandler(handler);
instrumentExportedHandlerScheduled(handler, optionsCallback);
instrumentExportedHandlerEmail(handler, optionsCallback);
instrumentExportedHandlerQueue(handler, optionsCallback);
instrumentExportedHandlerTail(handler, optionsCallback);
// This is here because Miniflare sometimes cannot get instrumented
} catch {
// Do not console anything here, we don't want to spam the console with errors
}
return handler;
}Steps to Reproduce
Use Sentry in a Cloudflare Worker, in my case with Hono, where you need to use @sentry/cloudflare and export Sentry.withSentry() returned handler, but you need to use Cloudflare Secret Store bindings.
Expected Result
Get the SENTRY_DSN string value from the secret store.
Actual Result
Additional Context
No response
Priority
React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Fields
Give feedbackNo fields configured for issues without a type.
Projects
Status
Waiting for: Product Owner