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

"Invariant failed" on npm start #23

Closed
mrkurt opened this issue Mar 21, 2022 · 6 comments
Closed

"Invariant failed" on npm start #23

mrkurt opened this issue Mar 21, 2022 · 6 comments

Comments

@mrkurt
Copy link
Contributor

mrkurt commented Mar 21, 2022

We're getting this error when on npm start after a migration command. I don't think there are more stack lines, though. Any idea if this is a misconfig or a bug of some kind?

```Preparing to run: sh start.sh as root
fra [info]+ npx prisma migrate deploy
Datasource "db": SQLite database "sqlite.db" at "file:/data/sqlite.db"
No pending migrations to apply.

  • npm run start

start
remix-serve build
/myapp/node_modules/tiny-invariant/dist/tiny-invariant.cjs.js:10
throw new Error(prefix);
^
Error: Invariant failed
at invariant (/myapp/node_modules/tiny-invariant/dist/tiny-invariant.cjs.js:10:15)
at Object. (/myapp/build/index.js:443:35)
at Module._compile (node:internal/modules/cjs/loader:1103:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1157:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)

@netdesignr
Copy link

@mrkurt thanks for escalating this here. Still no success in overcoming this issue

@netdesignr
Copy link

netdesignr commented Mar 21, 2022

@mrkurt ok, now that's weird. All fixed after I've tried rebuilding a couple of times. You might want to close this issue for now.

@brian-dlee
Copy link

brian-dlee commented May 18, 2022

I'm getting this same exact issue with a freshly created app from Indie stack when deploying to Fly.io. npm start works fine locally. If any has any suggestions I'm open. I imagine it's not Fly related. I've tried changing NPM versions between node:16 node:16-bullseye-slim and node:14 and tried upgrading NPM to the latest with in the Docker container since I figured it could be a minor package version resolution issue difference between my Mac and the linux container. The node:14 container had an issue with the npx prisma ... command in start.sh, so it's inconclusive whether or not that would have worked.

edit

I do get the same error when starting up the docker container and running npm start

root@dc0ccd1ec14b:/app# npm start

> start
> remix-serve build


/app/node_modules/tiny-invariant/dist/tiny-invariant.cjs.js:10
        throw new Error(prefix);
              ^
Error: Invariant failed
    at invariant (/app/node_modules/tiny-invariant/dist/tiny-invariant.cjs.js:10:15)
    at Object.<anonymous> (/app/build/index.js:146:35)
    at Module._compile (node:internal/modules/cjs/loader:1105:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.createApp (/app/node_modules/@remix-run/serve/index.js:39:12)
    at Object.<anonymous> (/app/node_modules/@remix-run/serve/cli.js:52:17)
root@dc0ccd1ec14b:/app#

@brian-dlee
Copy link

I found the issue for anyone else who happens upon this. invariant is used to check for SESSION_SECRET and I did not have a SESSION_SECRET secret defined in Fly. Lo and behold, the README outlines this step just fine.

@alifhaider
Copy link

What to do if I found this issue?

@machour
Copy link
Collaborator

machour commented Oct 29, 2022

@alifhaider you fill in a new issue with all details possible.

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

No branches or pull requests

6 participants