app[f59e0e80] ams [info] Error: Invariant failed

Hi… I have 2 ‘apps’ a default one and one “staging” and the repo uses the same secret etc (remix-blues-stack) my main action and deploy works absolutely fine. Both branches (main & staging(dev)) are identical yet the staging deploy yeilds this:

2022-04-23T18:50:26.253 app[f59e0e80] ams [info] Starting init (commit: 252b7bd)...

2022-04-23T18:50:26.281 app[f59e0e80] ams [info] Preparing to run: `docker-entrypoint.sh npm start` as root

2022-04-23T18:50:26.302 app[f59e0e80] ams [info] 2022/04/23 18:50:26 listening on [fdaa:0:5d09:a7b:23c8:f59e:e80:2]:22 (DNS: [fdaa::3]:53)

2022-04-23T18:50:26.977 app[f59e0e80] ams [info] > start

2022-04-23T18:50:26.977 app[f59e0e80] ams [info] > cross-env NODE_ENV=production node ./build/server.js

2022-04-23T18:50:27.629 app[f59e0e80] ams [info] 🔌 setting up prisma client to ams.top2.nearest.of.stice-staging-db.internal:5432

2022-04-23T18:50:27.645 app[f59e0e80] ams [info] /myapp/node_modules/tiny-invariant/dist/tiny-invariant.cjs.js:10

2022-04-23T18:50:27.645 app[f59e0e80] ams [info]         throw new Error(prefix);

2022-04-23T18:50:27.645 app[f59e0e80] ams [info]               ^

2022-04-23T18:50:27.645 app[f59e0e80] ams [info] Error: Invariant failed

2022-04-23T18:50:27.645 app[f59e0e80] ams [info]     at invariant (/myapp/node_modules/tiny-invariant/dist/tiny-invariant.cjs.js:10:15)

2022-04-23T18:50:27.645 app[f59e0e80] ams [info]     at Object. (/myapp/build/index.js:198:36)

2022-04-23T18:50:27.645 app[f59e0e80] ams [info]     at Module._compile (node:internal/modules/cjs/loader:1103:14)

2022-04-23T18:50:27.645 app[f59e0e80] ams [info]     at Object.Module._extensions..js (node:internal/modules/cjs/loader:1157:10)

2022-04-23T18:50:27.645 app[f59e0e80] ams [info]     at Module.load (node:internal/modules/cjs/loader:981:32)

2022-04-23T18:50:27.645 app[f59e0e80] ams [info]     at Function.Module._load (node:internal/modules/cjs/loader:822:12)

2022-04-23T18:50:27.645 app[f59e0e80] ams [info]     at Module.require (node:internal/modules/cjs/loader:1005:19)

2022-04-23T18:50:27.645 app[f59e0e80] ams [info]     at require (node:internal/modules/cjs/helpers:102:18)

2022-04-23T18:50:27.645 app[f59e0e80] ams [info]     at Object. (/myapp/build/server.js:59:89)

2022-04-23T18:50:27.645 app[f59e0e80] ams [info]     at Module._compile (node:internal/modules/cjs/loader:1103:14)

2022-04-23T18:50:28.294 app[f59e0e80] ams [info] Rein child exited normally with code: 1

2022-04-23T18:50:28.295 app[f59e0e80] ams [info] Reaped child process with pid: 547, exit code: 0

2022-04-23T18:50:28.295 app[f59e0e80] ams [info] Reaped child process with pid: 548, exit code: 1

2022-04-23T18:50:28.296 app[f59e0e80] ams [info] Starting clean up.
.```

I believe this happens in remix apps when the SESSION_SECRET is not set in a Remix app. You need to do something like this:

fly secrets set SESSION_SECRET=$(openssl rand -hex 32) --app blues-stack-template
fly secrets set SESSION_SECRET=$(openssl rand -hex 32) --app blues-stack-template-staging