remix-run / blues-stack

The Remix Stack for deploying to Fly with PostgreSQL, authentication, testing, linting, formatting, etc.
https://remix.run/stacks
MIT License
939 stars 231 forks source link

Error when trying to run the docker image #219

Open Sid-ah opened 10 months ago

Sid-ah commented 10 months ago

What version of Remix are you using?

1.19.3

Are all your remix dependencies & dev-dependencies using the same version?

Steps to Reproduce

I first ran:

  1. docker build -t sidah/demo:1.0
  2. docker run sidah/demo:1.0
  3. Here is the full error trace:
/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 getClient (/myapp/build/index.js:153:37)
    at Object.<anonymous> (/myapp/build/index.js:150:10)
    at Module._compile (node:internal/modules/cjs/loader:1198:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1252:10)
    at Module.load (node:internal/modules/cjs/loader:1076:32)
    at Function.Module._load (node:internal/modules/cjs/loader:911:12)
    at Module.require (node:internal/modules/cjs/loader:1100:19)
    at require (node:internal/modules/cjs/helpers:119:18)
    at Object.<anonymous> (/myapp/build/server.js:45110:77)

Expected Behavior

Expected the app to run successfully.

CleanShot 2023-10-18 at 16 12 30@2x

Actual Behavior

The app fails to run:

/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 getClient (/myapp/build/index.js:153:37)
    at Object.<anonymous> (/myapp/build/index.js:150:10)
    at Module._compile (node:internal/modules/cjs/loader:1198:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1252:10)
    at Module.load (node:internal/modules/cjs/loader:1076:32)
    at Function.Module._load (node:internal/modules/cjs/loader:911:12)
    at Module.require (node:internal/modules/cjs/loader:1100:19)
    at require (node:internal/modules/cjs/helpers:119:18)
    at Object.<anonymous> (/myapp/build/server.js:45110:77)
brophdawg11 commented 10 months ago

I'm not sure if this is a Remix issue. Is this a fresh Blues Stack app? The invariant is coming from a getClient method, and the Blues Stack doesn't have one of those so it seems like it's coming from your own code? The Blues Stack does create a prisma client with new PrismaClient so it's possible Prisma has an internal getClient function or something.

If you can provide a minimal reproduction repo of the issue, we can help dig in further.

Sid-ah commented 10 months ago

@brophdawg11, here are the repro steps:

  1. npx create-remix@latest --template remix-run/blues-stack
  2. cd myproject
  3. npm install
  4. npm run setup
  5. npm run build
  6. npm start so far everything works as expected.
  7. docker build -t sidah/demo:1.0
  8. I get an error when I run the following commands:docker run sidah/demo:1.0 -e DATABASE_URL=http://localhost:5432/ or docker run sidah/demo:1.0 -e DATABASE_URL=postgres://username:password@myproject.postgres.database.azure.com/postgres

Here is the error message:

SyntaxError: Unexpected token ':'
    at new Script (node:vm:94:7)
    at createScript (node:vm:251:10)
    at Object.runInThisContext (node:vm:299:10)
    at node:internal/process/execution:82:21
    at [eval]-wrapper:6:24
    at runScript (node:internal/process/execution:81:62)
    at evalScript (node:internal/process/execution:103:10)
    at node:internal/main/eval_string:29:3
brophdawg11 commented 10 months ago

This seems like a issue with the docker setup in the Blues Stack, I'm going to transfer this issue over there since the Remix build/start is working correctly.