Skip to content

fix(nextjs): Catch exceptions when syncing plug-in's version #3444

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

Merged
merged 3 commits into from
Apr 23, 2021

Conversation

iker-barriocanal
Copy link
Contributor

@iker-barriocanal iker-barriocanal commented Apr 22, 2021

Fixes #3441
Vercel's file system is read-only, so it throws an exception when trying to rewrite the plugin's version. This happens in runtime in every request in serverless environments.

Users are supposed to build the app before deploying it to Vercel (where the file system isn't read-only), since the plugin version must still be sync-ed.

@github-actions
Copy link
Contributor

github-actions bot commented Apr 22, 2021

size-limit report

Path Size
@sentry/browser - CDN Bundle (gzipped) 20.61 KB (+0.01% 🔺)
@sentry/browser - Webpack 21.49 KB (0%)
@sentry/react - Webpack 21.53 KB (0%)
@sentry/browser + @sentry/tracing - CDN Bundle (gzipped) 27.91 KB (0%)

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.

Can you please summarize the issue in a sentence or two in the PR description, so someone coming here can have at least a little context without having to click through to the issue?

@pudgereyem
Copy link

Hey @iker-barriocanal, thanks for looking into this.

Users are supposed to build the app before deploying it to Vercel, since the plugin version must still be sync-ed.

Can you expand on what you mean here? What am I supposed to do here? I'm using Vercel's Github Integration which makes it so that Vercel builds the project for me and then deploys. There's nothing for me to do there. Will that work? I believe most people use Vercel that way.

@lobsterkatie
Copy link
Member

Hey @iker-barriocanal, thanks for looking into this.

Users are supposed to build the app before deploying it to Vercel, since the plugin version must still be sync-ed.

Can you expand on what you mean here? What am I supposed to do here? I'm using Vercel's Github Integration which makes it so that Vercel builds the project for me and then deploys. There's nothing for me to do there. Will that work? I believe most people use Vercel that way.

I believe we're going to have to address this another way, given that workflow. We're working on it and will keep you posted.

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.

Let's merge this - it's a good change just for safety's sake.

Copy link
Contributor

@kamilogorek kamilogorek left a comment

Choose a reason for hiding this comment

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

Catching it is better than failing a deploy, although it's not clear what the user would need to do when this happens.

@pudgereyem
Copy link

pudgereyem commented Apr 23, 2021

I believe we're going to have to address this another way, given that workflow. We're working on it and will keep you posted.

@lobsterkatie cool, this is the only thing holding me back from using @sentry/nextjs as of now I believe. I'm not sure how easy it'd be for me to fork this repository and try to help out? My first attempt would be to see if it's possible to sync the versions through npm's postinstall script.

I'll do some other work in the meantime while waiting for this, since I think the (future) benefits of using @sentry/nextjs as you explained here sounds good.

All the best,
Victor

@iker-barriocanal
Copy link
Contributor Author

Can you expand on what you mean here?

@pudgereyem

although it's not clear what the user would need to do when this happens.

@kamilogorek

If this happens, the plug-in's version doesn't match with the nextjs' version. Building the project locally, where the package.json can be modified, will sync these versions and then can be deployed to Vercel. This is not the best fix, but will stop breaking some apps for the moment.

@kamilogorek
Copy link
Contributor

I know what will happen, but the user might not understand that based solely on that one console log :P

@iker-barriocanal
Copy link
Contributor Author

@kamilogorek message updated.

@iker-barriocanal iker-barriocanal merged commit 7b1c9f1 into master Apr 23, 2021
@iker-barriocanal iker-barriocanal deleted the fix/nextjs-plugin-readonly branch April 23, 2021 09:50
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.

@sentry/nextjs not working when deployed to Vercel
4 participants