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(remix): Resolve Remix Request API compatibility issues. #6215

Merged
merged 1 commit into from Nov 17, 2022

Conversation

onurtemizkan
Copy link
Collaborator

Ref: #6139 and #6139 (comment)

This PR is not a complete solution for all issues mentioned in #6139, but it aims to solve the parsing issue, which should fix auto-instrumented usage.

Remix uses its own implementation of Fetch API on both back-end and front-end, which has different structures storing headers and url. That has caused RequestData integration to not work properly on Remix projects.

I first attempted adding support to the core parser, and PolymorphicRequest. But it seemed very complex (if possible), because we have to type Proxy objects and Symbols, which our current TypeScript version doesn't fully support.

So, I vendored / modified a couple of unexported utilities from @remix-run/web-fetch, to convert request objects to a compatible structure that we can consume in RequestData integration.

@github-actions
Copy link
Contributor

github-actions bot commented Nov 16, 2022

size-limit report 📦

Path Size
@sentry/browser - ES5 CDN Bundle (gzipped + minified) 19.51 KB (+0.07% 🔺)
@sentry/browser - ES5 CDN Bundle (minified) 60.36 KB (+0.05% 🔺)
@sentry/browser - ES6 CDN Bundle (gzipped + minified) 18.17 KB (+0.09% 🔺)
@sentry/browser - ES6 CDN Bundle (minified) 53.71 KB (+0.03% 🔺)
@sentry/browser - Webpack (gzipped + minified) 19.9 KB (+0.04% 🔺)
@sentry/browser - Webpack (minified) 65.12 KB (+0.04% 🔺)
@sentry/react - Webpack (gzipped + minified) 19.93 KB (+0.07% 🔺)
@sentry/nextjs Client - Webpack (gzipped + minified) 45.89 KB (+0.03% 🔺)
@sentry/browser + @sentry/tracing - ES5 CDN Bundle (gzipped + minified) 26.33 KB (+0.03% 🔺)
@sentry/browser + @sentry/tracing - ES6 CDN Bundle (gzipped + minified) 24.74 KB (+0.06% 🔺)

Copy link
Member

@lobsterkatie lobsterkatie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this approach! (For everything else, we just special-case our parsing function to high heaven, but really, the responsibility for framework-specific stuff should lie with the framework.)

One small question, but otherwise LGTM!

// chunked encoding is handled by Node.js
const search = getSearch(parsedURL);

// Manually spread the URL object instead of spread syntax
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this your choice or just copied from their implementation? (Just curious why the spread operator is being avoided.)

Same question with the @ts-ignores below.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Neither of the above is a blocker (just my own curiosity), so I'm going to go ahead and merge this.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, they are copied from the original implementation. Not sure what's the reason for spread operator there, but it seems they have kept the approach of node-fetch.

@lobsterkatie
Copy link
Member

lobsterkatie commented Nov 17, 2022

<comment deleted because I accidentally pasted the Squash and Merge text here when trying to merge this>

@lobsterkatie lobsterkatie merged commit 0ee35f0 into master Nov 17, 2022
@lobsterkatie lobsterkatie deleted the onur/remix-request-compat branch November 17, 2022 01:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants