-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Error related to sourcemaps in production build #8309
Comments
Can confirm, I'm having the same issue on Windows 11. As far as I can tell, it seems like this is related to the 2.4.0 release. Pegged all remix packages locally to version 2.3.1 and that seems to have "solved" the issue. Think the issue might be related to this new feature: #8174 Stack trace for reference:
|
@VHall1 Does this problem happen for you in docker or normal builds? |
Normal builds. Got a repo to reproduce the issue going in here: https://github.com/VHall1/dummy-remix-app. Thrown an error inside of the index route and got the same issue |
THanks for the repro! |
I'll take a look. Thanks for the report. |
Just tested on mac and that seems to load the sourcemap correctly, so this is looking like a platform issue |
Took a stab at submitting a PR to fix this issue. Would appreciate another pair of eyes to review it and make sure everything makes sense as this is my first contribution to the project. |
This is resolved by #8321 and will be included in the next release 👍 |
Confirming that pegging to v2.3.1 fixes the issue. Thank you |
🤖 Hello there, We just published version Thanks! |
@Hey @brophdawg11, I tried this wil |
Are you using Remix App Server or Express? Can you log the https://github.com/remix-run/remix/pull/8321/files?diff=unified&w=1 It looks like this fix works for macOS and Windows, but perhaps Linux is different. Does the map file actually exist at the paths logged? |
By default, Vite doesn't generate sourcemaps for production builds. You will need to pass the Just note that sourcemaps contain the entire source, so client sourcemaps will contain server code as well. |
Hello @kiliman , is it known why the |
Yep, as mentioned above, I do not want to generate the final build with sourcemaps (or anything useless for that matter). |
🤖 Hello there, We just published version Thanks! |
@IgnisDa Hmm... then I'm not sure why it's trying to access sourcemaps if you're not generating them. Can you check //# sourceMappingURL=index.js.map If not, I'm not sure why @brophdawg11 we may need to re-open this. |
Hello @kiliman Just checked on my end - to give more context, this is a Vite build. I do NOT have this in the generated |
FYI Upgrading to v2.4.1 did not fix the issue. |
Is this only happening in Docker? Linux? I cannot reproduce this using Vite Dev Server or Custom Express server on macOS. I'm on Remix v2.4.1. |
Also, does the error occur on startup, and your app won't run? Or do you get the sourcemap error when an exception is thrown? |
* build(frontend): downgrade remix to `v2.3.1`. Because of remix-run/remix#8309. * ci(frontend): downgrade remix version * build(backend): bump version
Just to add some more discussion/a pnpm solution I've fixed it by applying a patch to remix.
it will prompt you with a file to edit, here is the new content (if on mac you can cmd +click it to open it in vscode) sourceMapSupport__default["default"].install({
retrieveSourceMap: function (source) {
// get source file with the `file://` prefix
let match = source.match(/^file:\/\/(.*)$/);
if (match) {
let filePath = url__default["default"].fileURLToPath(source);
// return {
// url: source,
// map: fs__default["default"].readFileSync(`${filePath}.map`, "utf8")
// };
}
return null;
}
}); I just commented out the return so it always is returning null on sourceMap In the same terminal where you ran patch it should give you a command to run to apply the patch. Something like this: You also have to update your docker file to copy over your patches directory at build time so pnpm install will apply them.
Such is life in unstable land. |
Any updates here. I'm getting this error. Is this the same bug?
|
The most straight-forward solution right now is to stay on 2.3.1 or apply one of the patches recommended above. |
Looking at this again, and wondering if one of the issues only happens when errors are thrown by external packages, rather than the components themselves. Seems like source-map-support might be passing the dependency URL in the edit: catching up on this now. Seems like a patch has been provided already. Tried locally and can confirm it works with node packages |
When trying to access the Zod errors, it somehow trips the installed sourcemapping which fails and throws an error because Zod doesn't ship with source maps. This bug (or at least a very similar one) is being tracked in remix-run/remix#8309, but until it is resolved, I'm pinning the version of the Remix server to 2.3.1 since that is the latest version that is not affected.
Experienced the same with postgres.js ✌️ Solved the issue by downgrading to |
Yes, I can confirm that downgrading to 2.3.1 fixes the issue. |
Gave this another shot. I believe this update should resolve both of the issues raised above (3rd party packages and source maps not available). |
🤖 Hello there, We just published version Thanks! |
It works with the above pre-release. Thanks @VHall1! |
that is great! Thanks for confirming 😄 |
Hey @VHall1, when will |
🤖 Hello there, We just published version Thanks! |
any updates? |
@erlangparasu This has long since been fixed with 2.5.0. I recommend you upgrade to that version and if the issue still persists, create a new issue. |
thanks 2.5.0 works |
Reproduction
Using a unstable vite template and building and deploying it gives an error about a sourcemap file missing.
All remix packages are at
v2.4.0
.Here is the part of the dockerfile that copies relevant files.
System Info
Used Package Manager
yarn
Expected Behavior
The production server to work fine.
Actual Behavior
Here is the stderr for the server:
The text was updated successfully, but these errors were encountered: