-
Notifications
You must be signed in to change notification settings - Fork 400
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
configure msw to blacklist sentry #652
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I'd rather add a handler for these and use passthrough.
how would you achieve this with passthrough? we cannot do something like this const miscHandlers = process.env.REMIX_DEV_ORIGIN ? [
http.post(`${process.env.REMIX_DEV_ORIGIN}ping`, passthrough),
process.env.SENTRY_DSN && http.post(process.env.SENTRY_DSN, passthrough)
].filter(Boolean) : [] because the url we have in SENTRY_DNS is something like https://[email protected]/project-key but the post request is actually made towards https://user.ingest.us.sentry.io/api/project-key there is an extra /api therefore I cannot think of an elegant solution with passthrough without getting hacky the solution I proposed in this PR used to be in the doc if I remember correctly, at least it's the one I have been using for years. I actually did not bother looking in my old projects and googled it to get this peace of code from the author of mswjs mswjs/msw#1589 (comment) |
Could we not add |
"user" here is unique for everyone, I could do this and it would only work for me and I'll be sharing a username that was private before (defined by env variable) using glob pattern is not supported. the following won't work http.post('https://*.ingest.us.sentry.io/api/', passthrough) using parameters won't work in this situation neither because :userId is a cname http.post('https://:userId.ingest.us.sentry.io/api/:projectId/envelope', passthrough) There is actually a feature request to intercept urls with more granularity |
Gotcha. In that case, could you add a comment above the code to reference that issue and then we can merge this :) |
using request handler with passthrough requires a more permissible url catching system
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
It looks like this commit didn't make it into main, possible got mulched by a later rebase? |
Hmm... What are we missing? Looks like it's in main right now: https://github.com/epicweb-dev/epic-stack/blob/78ef2528cf3d6ae284bd183c85c9a7270a90b933/tests/mocks/index.ts |
fix #651