My docker image is breaking with prisma 2.9.0 Sho...
# graphql-nexus
r
My docker image is breaking with prisma 2.9.0 Should I open issue for prisma or nexus-prisma-plugin? ๐Ÿค”
Copy code
internal/modules/cjs/loader.js:960
  throw err;
  ^

Error: Cannot find module '@prisma/client'
Require stack:
- /app/dist/context.js
- /app/dist/index.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:957:15)
    at Function.Module._load (internal/modules/cjs/loader.js:840:27)
    at Module.require (internal/modules/cjs/loader.js:1019:19)
    at require (internal/modules/cjs/helpers.js:77:18)
    at Object.<anonymous> (/app/dist/context.js:4:18)
    at Module._compile (internal/modules/cjs/loader.js:1133:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10)
    at Module.load (internal/modules/cjs/loader.js:977:32)
    at Function.Module._load (internal/modules/cjs/loader.js:877:14)
    at Module.require (internal/modules/cjs/loader.js:1019:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ '/app/dist/context.js', '/app/dist/index.js' ]
}
r
What version of Nexus are you using?
r
"@nexus/schema": "^0.16.0",
yarn dev
runs ok. It occurs only when I build in docker
r
It's possible that the latest version of Prisma may not be compatible with Nexus. Let me check
Itโ€™s working fine for me. Could you share your
Dockerfile
?
r
I still need to optimize it and I accept improvement suggestion ๐Ÿ™‚ Here we go:
Copy code
FROM node:12.16-alpine

ARG SERVER_PORT=4600

WORKDIR /app

COPY package.json yarn.lock tsconfig.json ./
RUN yarn install

COPY src ./src/
COPY prisma ./prisma/
ENV SERVER_PORT=$SERVER_PORT

RUN yarn prisma generate
RUN yarn run build

# Remove dev dependencies
RUN yarn install --production

EXPOSE $SERVER_PORT

CMD ["node", "dist/index.js"]
the build is
"build": "yarn -s clean && yarn -s generate && tsc",
r
Your
Dockerfile
looks fine. Hereโ€™s mine that I used to check. https://github.com/ryands17/nexus-auth
r
My
Dockerfile
works if I comment this
RUN yarn install --production
. I do it to be able to remove devDependencies from production after compiling. For some reason in 2.9.0 is doesn't work
r
Do you have anything related to Prisma in devDependencies?
r
Copy code
"devDependencies": {
    "@prisma/cli": "2.9.0",
    "@prisma/client": "2.9.0",
    "@types/node": "^14.11.8",
    "ts-node": "^9.0.0",
    "ts-node-dev": "^1.0.0-pre.63",
    "typescript": "^4.0.3"
  }
I have this in schema.ts
Copy code
typegenAutoConfig: {
    contextType: "Context.Context",
    sources: [
      {
        source: ".prisma/client",
        alias: "prisma",
      },
      {
        source: require.resolve("./context"),
        alias: "Context",
      },
    ],
  }
r
@prisma/client
should be in dependencies and not dev
r
True! Thanks
๐Ÿ‘ 1
Thanks for sharing your repo. Here is mine, btw ๐Ÿ™‚ https://github.com/ricardoalmeida/federation-nexus-prisma
๐Ÿ™Œ 1
r
Will have a look at it. I was interested in trying out Apollo Federation ๐Ÿ™‚