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.

Invalid photon through Docker image

See original GitHub issue

Hi,

I’m trying to deploy my working web-app including a backend with prisma2.

But when i start the docker image, an error appears with the first “photon.mytable” call: Invalid photon.() invocation in /usr/src/app/main.js Reason: Error occurred during query execution: ConnectorError(ConnectorError { user_facing_error: None, kind: QueryError(SqliteFailure(Error { code: Unknown, extended_code: 1 }, Some("no such table: dev.mytable"))

This behavior looks like i didn’t generated the schema, but i did in dockerfile:

FROM node:12.9.1-stretch
LABEL name="myapp-back" version="0.1.0"

WORKDIR /usr/src/app
COPY ./package.json package.json
COPY ./yarn.lock yarn.lock

RUN yarn install --frozen-lockfile --prod

COPY ./tsconfig.json tsconfig.json
COPY ./prisma/schema.prisma prisma/schema.prisma 
RUN yarn generate    <-- calls "prisma2 generate" in package.json

COPY ./src src
RUN yarn build

COPY ./src/schema.graphql ./dist/schema.graphql

ENV NODE_ENV prod
EXPOSE 4000

CMD ["yarn", "start"]

Moreover, this backend works fine on my local machine (out of a Docker image).

For info, schema.prisma starts with:

generator photon {
  provider      = "photonjs"
  binaryTargets = ["native", "debian-openssl-1.1.x"]
}

datasource db {
  provider = "sqlite"
  url      = "file:dev.db"
}

Any idea ?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8

github_iconTop GitHub Comments

2reactions
jean-noelpcommented, Jan 15, 2020

Thanks, it works! 😃

The entire solution: 1- think to backup prisma/migrations at the initial state with prisma2 lift save 2- use this Dockerfile:

FROM node:12.9.1-stretch
LABEL name="myapp-back" version="0.1.0"

WORKDIR /usr/src/app
COPY ./package.json package.json
COPY ./yarn.lock yarn.lock

RUN yarn install --frozen-lockfile --prod

COPY ./prisma/schema.prisma prisma/schema.prisma 
COPY ./prisma/migrations prisma/migrations.
RUN yarn generate        <-- prisma2 generate
RUN yarn dbintro           <-- prisma2 lift up --auto-approve

COPY ./tsconfig.json tsconfig.json
COPY ./src src
RUN yarn build

COPY ./src/schema.graphql ./dist/schema.graphql

ENV NODE_ENV production
EXPOSE 4000

CMD ["yarn", "start"]

Be careful: this is a versatile server: each time you will reload your image, the database will be reset! Think to use an external image/service to keep data.

1reaction
malekjaroslavcommented, Jan 15, 2020

try prisma2 lift up --auto-approve

Read more comments on GitHub >

github_iconTop Results From Across the Web

Docker image pull error invalid character - Stack Overflow
HI all.. The issue was due to the image was missing in the DTR.. the image was pushed to a different DTR in...
Read more >
How to Fix and Debug Docker Containers Like a Superhero
Container errors are tricky to diagnose, but some investigative magic works wonders. Read along to learn how to debug Docker containers.
Read more >
Image-building best practices - Docker Documentation
When you have built an image, it is a good practice to scan it for security vulnerabilities using the docker scan command. Docker...
Read more >
Troubleshoot volume errors - Docker Documentation
This topic discusses errors which may occur when you use Docker volumes or bind mounts. Error: Unable to remove filesystem. Some container-based utilities, ......
Read more >
Use macvlan networks - Docker Documentation
In this type of situation, you can use the macvlan network driver to assign a MAC address to each container's virtual network interface,...
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