Skip to content

Commit

Permalink
Merge branch 'develop' into bruno-dasilva/ignore-rethrown-errors-in-l…
Browse files Browse the repository at this point in the history
…ocalvariables-integration
  • Loading branch information
timfish authored Aug 27, 2024
2 parents eab8797 + 6cb6999 commit 067c0de
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ jobs:
name: ${{ github.sha }}
path: |
${{ github.workspace }}/packages/browser/build/bundles/**
${{ github.workspace }}/packages/replay/build/bundles/**
${{ github.workspace }}/packages/replay-internal/build/bundles/**
${{ github.workspace }}/packages/replay-canvas/build/bundles/**
${{ github.workspace }}/packages/feedback/build/bundles/**
${{ github.workspace }}/packages/**/*.tgz
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,3 @@ Sentry.init({
feedbackIntegration({ tags: { from: 'integration init' }, styleNonce: 'foo1234', scriptNonce: 'foo1234' }),
],
});

document.addEventListener('securitypolicyviolation', () => {
const container = document.querySelector('#csp-violation');
if (container) {
container.innerText = 'CSP Violation';
}
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
window.__CSPVIOLATION__ = false;
document.addEventListener('securitypolicyviolation', () => {
window.__CSPVIOLATION__ = true;
});
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,5 @@
content="style-src 'nonce-foo1234'; script-src sentry-test.io 'nonce-foo1234';"
/>
</head>
<body>
<div id="csp-violation" />
</body>
<body></body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,6 @@ sentryTest('should capture feedback', async ({ getLocalTestUrl, page }) => {
},
platform: 'javascript',
});
const cspContainer = await page.locator('#csp-violation');
expect(cspContainer).not.toContainText('CSP Violation');
const cspViolation = await page.evaluate<boolean>('window.__CSPVIOLATION__');
expect(cspViolation).toBe(false);
});
18 changes: 9 additions & 9 deletions packages/cloudflare/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,16 +114,16 @@ Currently only ESM handlers are supported.
import * as Sentry from '@sentry/cloudflare';

export default withSentry(
(env) => ({
dsn: env.SENTRY_DSN,
env => ({
dsn: env.SENTRY_DSN,
// Set tracesSampleRate to 1.0 to capture 100% of spans for tracing.
tracesSampleRate: 1.0,
}),
{
async fetch(request, env, ctx) {
return new Response('Hello World!');
},
} satisfies ExportedHandler<Env>
tracesSampleRate: 1.0,
}),
{
async fetch(request, env, ctx) {
return new Response('Hello World!');
},
} satisfies ExportedHandler<Env>,
);
```

Expand Down
6 changes: 6 additions & 0 deletions packages/feedback/src/core/sendFeedback.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@ export const sendFeedback: SendFeedback = (
);
}

if (response && typeof response.statusCode === 'number' && response.statusCode === 403) {
return reject(
'Unable to send Feedback. This could be because this domain is not in your list of allowed domains.',
);
}

return reject(
'Unable to send Feedback. This could be because of network issues, or because you are using an ad-blocker',
);
Expand Down

0 comments on commit 067c0de

Please sign in to comment.