-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Not able to deploy on Fly via Docker: top-level await
error
#6357
Comments
The top-level await
errortop-level await
error
This is affecting me as well when I upgrade from Remix 1.13 to 1.16 (so could be 1.14 was when it was introduced). I'm not using fly or any of the remix stacks, so this doesn't appear related to any of the templates. Our repo is loosely modeled after blues stack. The error doesn't occur when calling our own esbuild on the server file. esbuild doesn't support top level await, but it looks like @remix/dev relies on @jspm/core via
|
I was able to circumvent the issue with an npm override:
|
Looks like another issue popped up and it might be related to the overrides that I tried:
This error persists even with no routes, so it appears to be including node polyfills in the browser build. I'm not sure if this is actually related to the override or not since I can't build without that override. |
@nakleiderer I am in the same boat, your "overrides" fixed it for me but i am also getting the "buffer" error now too. I am pretty sure some package is getting included in the browser build as well... |
Just saw Remix 1.16.1 dropped and gave it a shot, but receiving the same errors. I have two apps with the same error now, so maybe I can figure out a reproduction. This affects the production build and the dev builds. |
@bvkimball and @binajmen: Would you mind posting your package.json in a gist and linking here? I wonder if there's a common dependency causing the issue. I have 54 dependencies in common between my remix apps, hoping to narrow that down to make a reproduction based on your deps. It's a bit of a stretch, but will hopefully give more info. |
Here are the relevant deps... i can add devDeps if you want. https://gist.github.com/bvkimball/5f93ed2ad2f81fbd8279c71641860200 I use a mono-repo similar to this, but not the same: https://github.com/NoQuarterTeam/boilerplate I am in the process of cleaning this up now too so i will remove any unused deps and let you know I think its prisma or zenstack for me that is causeing it. |
This is what we appear to have in common:
I filtered out the dependencies used in the Remix Express template, because it works out of the box. |
It looks like something is causing |
Probably not helpful, but removing this line makes everything work again:
EDIT: That was only with the overrides in place. This doesn't fix it with the latest esbuild-plugin-polyfill-node version |
In one of my projects, I had a resource route that imported a library with node library usage. When I put that dependency behind a I also had to update a Sentry import from I found I had more luck updating remix version-by-version instead of leaping from 1.13 > 1.16.1 directly. I was able to get better error messages for issues along the way, fix them, then upgrade to the next version. |
Ok, thank you for all the help.... I deleted everything in my routes until it was just and index, root, and entry.x files I basically couldn't narrow it down to just one thing... but basically if my mono-repo packages bleed any node dep than it borked. Basically treeshaking was working or i missed something. for me i re-exported all my monorepo packages in a file like export * from `@monorepo/[package]`; i wish i could just mark packages as server only. |
I really figured it what caused it for my repo. I include I assumed that the There are several other issues listing this in issues now: |
It seems like Remix is suddenly importing files that used to be tree-shaken out of the browser build. In my other project, Sentry was also getting included despite never being used client-side. This may be specific to this kind of import: I think Remix needs a few things to put these issues to rest:
|
I had the same problem and solved it by migrating some deprecated If you get this during startup:
It might also work for you. |
It looks like there's a couple of solutions here:
It might be worth raising this as an issue upstream against esbuild-plugins-node-modules-polyfill since that plugin could potentially stub out I'm closing this for now, but if this doesn't help address your problem, could you please open a new, more specific issue with a reproduction? |
What version of Remix are you using?
v1.14.0
Are all your remix dependencies & dev-dependencies using the same version?
Steps to Reproduce
Deploy to Fly using Docker
Expected Behavior
Build should succeed
Actual Behavior
Build step is failing:
The text was updated successfully, but these errors were encountered: