question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error: Invariant failed -> In Remix project

See original GitHub issue

Hi,

I’m facing this error during Github Action CI, can someone please advice?

> start:mocks
> binode --require ./mocks -- @remix-run/serve:remix-serve build

🔶 Mock server running

/home/runner/work/project-name/tproject-namenode_modules/tiny-invariant/dist/tiny-invariant.cjs.js:10
        throw new Error(prefix);
              ^
Error: Invariant failed
    at invariant (/home/runner/work/project-name/project-name/node_modules/tiny-invariant/dist/tiny-invariant.cjs.js:10:15)
    at Object.<anonymous> (/home/runner/work/project-name/project-name/build/index.js:124:35)
    at Module._compile (node:internal/modules/cjs/loader:1126:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1180:10)
    at Module.load (node:internal/modules/cjs/loader:1004:32)
    at Function.Module._load (node:internal/modules/cjs/loader:839:12)
    at Module.require (node:internal/modules/cjs/loader:1028:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (/home/runner/work/project-name/project-name/node_modules/@remix-run/serve/dist/cli.js:48:13)
    at Module._compile (node:internal/modules/cjs/loader:1126:14)
http://localhost:8811 timed out on retry 91 of 3, elapsed 90246ms, limit 90000ms
Error: connect ECONNREFUSED 127.0.0.1:8811

Any thoughts on the above?

Thanks a lot!

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:1
  • Comments:14 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
SMysakowskicommented, Nov 11, 2022

I found the problem also. But I forgot to set secret environment on fly.io. Remix use tiny-variant to validate env value.

(0, import_tiny_invariant.default)(process.env.SESSION_SECRET, "SESSION_SECRET must be set");

If you didn’t set the environment and use indie stack. this is the command to set env

flyctl secrets set DATABASE_URL="{your db url}"              #example "file:./data.db?connection_limit=1"
flyctl secrets set SESSION_SECRET="{your secret}"            #example "super-duper-s3cret"

doc: https://fly.io/docs/reference/secrets/#setting-secrets

After set these 2 config, the deployment was success.

Hi @hawkup 😃

In my case, it is not connected with fly deployment because I have already deployed the app.

But I took a closer look at deploy.yml prepared by Indie stack. I rewrote the part which was preparing .env for cypress job, and it works.

IMO ticket to close. It was strictly connected with the GitHub Actions configuration in the Remix template.

1reaction
pkerschbaumcommented, Nov 12, 2022

I would suggest to close this issue as it is just an invariant failing in the remix-run/indie-stack project.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error: Invariant failed: SESSION_SECRET must be set #71
Just fyi, to use yarn, create the project using yarn create remix instead of npx ... . The installer will use yarn for...
Read more >
Another "Can't Deploy a New Remix App" post - Fly.io
Ayup - I just greped for fly secrets in the codebase and stumbled across it. We might want to drop a note on...
Read more >
Invariant failed: You should not use <Route> outside a <Router>
Show activity on this post. In my case, this error was caused due to mixing up usage of things (withRouter, MemoryRouter) from react-router...
Read more >
Blog Tutorial (short) - Remix
Initialize a new Remix project. We'll call ours "blog-tutorial" but you can call it something else if you'd like. npx create-remix@latest --template ...
Read more >
Create a New Remix Project Using the remix-create CLI
Error: Cannot find module './seed.ts' Require stack: /Users/arti/learn/onewheel-blog/prisma/imaginaryUncacheableRequireResolveScript at Function ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found