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

Error when trying to run the docker image #219

Open
1 task done
Sid-ah opened this issue Oct 18, 2023 · 3 comments
Open
1 task done

Error when trying to run the docker image #219

Sid-ah opened this issue Oct 18, 2023 · 3 comments

Comments

@Sid-ah
Copy link

Sid-ah commented Oct 18, 2023

What version of Remix are you using?

1.19.3

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

  • Yes

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
Copy link
Contributor

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.

@brophdawg11 brophdawg11 added the needs-response We need a response from the original author about the issue label Oct 19, 2023
@Sid-ah
Copy link
Author

Sid-ah commented Oct 20, 2023

@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

@github-actions github-actions bot removed the needs-response We need a response from the original author about the issue label Oct 20, 2023
@brophdawg11
Copy link
Contributor

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.

@brophdawg11 brophdawg11 transferred this issue from remix-run/remix Oct 23, 2023
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

2 participants