W
Wasp-lang14h ago
2euxs

failed to fetch an image or build from source: error building

Hi Wasp Team, im getting this error while trying to deploy wasp opensaas template with fly.io : failed to fetch an image or build from source: error building: failed to solve: failed to parse stage name "node:-slim": invalid reference format Do you have any clue on how I could fix that ?
No description
18 Replies
kapa.ai
kapa.ai14h ago
Hi @2euxs. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- This error seems to be related to the Dockerfile configuration. The error message suggests that there's an issue with the Node image reference format in your Dockerfile. In the Wasp GitHub issues, there's a closed issue (https://github.com/wasp-lang/wasp/issues/667) that suggests upgrading the Node base image version in the Dockerfile to 16. The Dockerfile should start with FROM node:16-alpine AS node. Please check your Dockerfile and ensure that the Node image reference is correctly formatted. If you're using an older version of Node, consider upgrading to version 16 as suggested in the GitHub issue. If the problem persists, it might be helpful to share your Dockerfile or any relevant code for further assistance. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @2euxs, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist: Perhaps try again in 15mins?
2euxs
2euxs14h ago
@kapa.ai Thanks, this fixed the error. But now I have a new one : Error: failed to fetch an image or build from source: error building: failed to solve: failed to compute cache key: failed to calculate checksum of ref 2096f6e3-e971-4083-b88a-df866b4f2a87::n6x7naw1bb7vueyrzqeui0lql: "/prisma": not found\n
kapa.ai
kapa.ai14h ago
Let me check the knowledge base for you. One moment! :books: ---------------------- This error message suggests that the Docker build process is unable to find the /prisma directory. In Wasp, the Prisma schema is usually located in the db directory, not prisma. If you've renamed the db directory to prisma, you'll need to update all references to this directory in your codebase. For example, in a closed issue (https://github.com/wasp-lang/wasp/issues/427) on the Wasp GitHub, the Prisma client is initialized with a path that includes ./node_modules/.prisma/client. If you've renamed the db directory to prisma, you'll need to update this path accordingly. If you haven't renamed the db directory to prisma, the error might be due to a misconfiguration in your Dockerfile or another part of your build process. Please check your Dockerfile and any scripts that are part of your build process to ensure they're correctly referencing the db directory. If the problem persists, it might be helpful to share your Dockerfile or any relevant code for further assistance. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @2euxs, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist: Perhaps try again in 15mins?
2euxs
2euxs14h ago
@kapa.ai Here is what my Docker file looks like : syntax = docker/dockerfile:1 Adjust NODE_VERSION as desired ARG NODE_VERSION=20.13.1 FROM node:16-alpine AS node LABEL fly_launch_runtime="NodeJS/Prisma" NodeJS/Prisma app lives here WORKDIR /app Set production environment ENV NODE_ENV=production Throw-away build stage to reduce size of final image FROM base as build Install packages needed to build node modules RUN apt-get update -qq && \ apt-get install -y python-is-python3 pkg-config build-essential openssl Install node modules COPY --link package.json package-lock.json . RUN npm install --production=false Generate Prisma Client COPY --link prisma . RUN npx prisma generate Copy application code COPY --link . . Remove development dependencies RUN npm prune --production Final stage for app image FROM base Copy built application COPY --from=build /app /app Entrypoint prepares the database. ENTRYPOINT ["/app/docker-entrypoint"] Start the server by default, this can be overwritten at runtime CMD [ "npm", "run", "start" ]
kapa.ai
kapa.ai14h ago
Let me check the knowledge base for you. One moment! :books: ---------------------- Your Dockerfile seems to be referencing a prisma directory that might not exist in your project structure. In Wasp, the Prisma schema is usually located in the db directory. You should replace this line:
COPY --link prisma .
COPY --link prisma .
with:
COPY --link db .
COPY --link db .
And then run the Prisma generate command:
RUN cd db && npx prisma generate
RUN cd db && npx prisma generate
This will ensure that the Docker build process is correctly referencing the db directory where your Prisma schema is located. Also, please note that the ARG NODE_VERSION=20.13.1 line seems to be unused and the Node version is hardcoded to 16 in the FROM node:16-alpine AS node line. You might want to adjust this to use the NODE_VERSION argument if that was your intention. If the problem persists, please check your project structure to ensure that all directories and files referenced in your Dockerfile exist and are correctly named. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @2euxs, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist: Perhaps try again in 15mins?
2euxs
2euxs14h ago
New Error : 'Error: failed to fetch an image or build from source: error building: failed to solve: process "/bin/sh -c apt-get update -qq && apt-get install -y python-is-python3 pkg-config build-essential openssl" did not complete successfully: exit code: 127\n @kapa.ai New Error : 'Error: failed to fetch an image or build from source: error building: failed to solve: process "/bin/sh -c apt-get update -qq && apt-get install -y python-is-python3 pkg-config build-essential openssl" did not complete successfully: exit code: 127\n
kapa.ai
kapa.ai14h ago
Let me check the knowledge base for you. One moment! :books: ---------------------- The error message suggests that the Docker build process is unable to run the apt-get command. This is likely because you're using an Alpine-based Node image, which uses apk as its package manager, not apt-get. In a closed issue (https://github.com/wasp-lang/wasp/issues/572) on the Wasp GitHub, the Dockerfile uses apk to install packages on an Alpine-based Node image. You should replace this line:
RUN apt-get update -qq && \
apt-get install -y python-is-python3 pkg-config build-essential openssl
RUN apt-get update -qq && \
apt-get install -y python-is-python3 pkg-config build-essential openssl
with:
RUN apk add --no-cache python3 pkgconf build-base openssl
RUN apk add --no-cache python3 pkgconf build-base openssl
This will ensure that the Docker build process is using the correct package manager for your Alpine-based Node image. If the problem persists, please check your Dockerfile to ensure that all commands are compatible with the Alpine Linux distribution. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @2euxs, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist: Perhaps try again in 15mins?
2euxs
2euxs14h ago
@kapa.ai 'Error: failed to fetch an image or build from source: error building: failed to solve: process "/bin/sh -c cd db && npx prisma generate" did not complete successfully: exit code:
kapa.ai
kapa.ai14h ago
Let me check the knowledge base for you. One moment! :books: ---------------------- The error message suggests that the Docker build process is unable to run the npx prisma generate command in the db directory. This could be due to a number of reasons, such as the db directory not existing, the Prisma CLI not being installed, or the Prisma schema file not being found. Here are a few things you can check: 1. Ensure that the db directory exists in your project and that it contains your Prisma schema file. The Prisma schema file is usually named schema.prisma. 2. Make sure that the Prisma CLI is installed. In your Dockerfile, you should have a command that installs the Prisma CLI, such as npm install @prisma/cli. If you don't have this command in your Dockerfile, you'll need to add it. 3. Check that the Prisma schema file is correctly referenced in your Dockerfile. In a closed issue (https://github.com/wasp-lang/wasp/issues/726) on the Wasp GitHub, the Dockerfile copies the Prisma schema file into the Docker image with the command COPY db/schema.prisma ./db/. Make sure you have a similar command in your Dockerfile. If the problem persists, it might be helpful to share your Dockerfile or any relevant code for further assistance. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @2euxs, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist: Perhaps try again in 15mins?
2euxs
2euxs14h ago
@kapa.ai 'Error: failed to fetch an image or build from source: error building: failed to solve: failed to compute cache key: failed to calculate checksum of ref 2096f6e3-e971-4083-b88a-df866b4f2a87::se8q7rky6af9na15oq3m4zwt0: "/app": not found\n'
kapa.ai
kapa.ai14h ago
Let me check the knowledge base for you. One moment! :books: ---------------------- The error message suggests that the Docker build process is unable to find the /app directory. This could be due to a number of reasons, such as the /app directory not existing in your Docker context, or a misconfiguration in your Dockerfile. Here are a few things you can check: 1. Ensure that the /app directory exists in your Docker context. The Docker context is usually the directory that contains your Dockerfile and any files and directories that are copied into your Docker image. 2. Check that the /app directory is correctly referenced in your Dockerfile. In your Dockerfile, you should have a command that sets the working directory to /app, such as WORKDIR /app. If you don't have this command in your Dockerfile, you'll need to add it. 3. Make sure that any commands that reference the /app directory are correctly formatted. For example, if you have a command that copies files into the /app directory, such as COPY . /app, make sure that the source directory exists in your Docker context and that the destination directory is correctly referenced. If the problem persists, it might be helpful to share your Dockerfile or any relevant code for further assistance. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @2euxs, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist: Perhaps try again in 15mins?
2euxs
2euxs14h ago
Here is what my dockerfile looks like : # syntax = docker/dockerfile:1 Adjust NODE_VERSION as desired ARG NODE_VERSION=20.13.1 FROM node:16-alpine AS node LABEL fly_launch_runtime="NodeJS/Prisma" NodeJS/Prisma app lives here WORKDIR /app Set production environment ENV NODE_ENV=production Throw-away build stage to reduce size of final image FROM base as build Install packages needed to build node modules RUN apk add --no-cache python3 pkgconf build-base openssl Install node modules COPY --link package.json package-lock.json . RUN npm install --production=false Generate Prisma Client COPY --link db . RUN npx prisma generate Copy application code COPY --link . . Remove development dependencies RUN npm prune --production Final stage for app image FROM base Copy built application COPY --from=build /app /app Entrypoint prepares the database. ENTRYPOINT ["/app/docker-entrypoint"] Start the server by default, this can be overwritten at runtime CMD [ "npm", "run", "start" ] Here is what my docker file looks like @kapa.ai # syntax = docker/dockerfile:1 Adjust NODE_VERSION as desired ARG NODE_VERSION=20.13.1 FROM node:16-alpine AS node LABEL fly_launch_runtime="NodeJS/Prisma" NodeJS/Prisma app lives here WORKDIR /app Set production environment ENV NODE_ENV=production Throw-away build stage to reduce size of final image FROM base as build Install packages needed to build node modules RUN apk add --no-cache python3 pkgconf build-base openssl Install node modules COPY --link package.json package-lock.json . RUN npm install --production=false Generate Prisma Client COPY --link db . RUN npx prisma generate Copy application code COPY --link . . Remove development dependencies RUN npm prune --production Final stage for app image FROM base Copy built application COPY --from=build /app /app Entrypoint prepares the database. ENTRYPOINT ["/app/docker-entrypoint"] Start the server by default, this can be overwritten at runtime CMD [ "npm", "run", "start" ]
kapa.ai
kapa.ai14h ago
Let me check the knowledge base for you. One moment! :books: ---------------------- Your Dockerfile seems to have a few issues that might be causing the problems you're experiencing. Here are some suggestions: 1. The ARG NODE_VERSION=20.13.1 line seems to be unused and the Node version is hardcoded to 16 in the FROM node:16-alpine AS node line. You might want to adjust this to use the NODE_VERSION argument if that was your intention. 2. The FROM base as build line is referencing a base image that doesn't exist. You should replace base with node to reference the Node image you defined earlier. The corrected line should be FROM node as build. 3. The COPY --link db . line is copying the db directory into the current directory (.), but it should be copying the contents of the db directory into a db directory in the Docker image. The corrected line should be COPY --link db ./db. 4. The COPY --link . . line is copying the current directory (.) into the current directory in the Docker image. This might be causing issues if there are files or directories in your current directory that shouldn't be in the Docker image. You should specify which files or directories to copy into the Docker image. 5. The FROM base line in the final stage of your Dockerfile is also referencing a base image that doesn't exist. This should be replaced with FROM node. 6. The ENTRYPOINT ["/app/docker-entrypoint"] line is setting the entrypoint to a script at /app/docker-entrypoint, but it doesn't look like this script is being copied into the Docker image. You should add a COPY command to copy this script into the Docker image, or update the ENTRYPOINT to a script or command that exists in the Docker image. Here's how your Dockerfile might look with these corrections:
# syntax = docker/dockerfile:1
# Adjust NODE_VERSION as desired
ARG NODE_VERSION=20.13.1
FROM node:${NODE_VERSION}-alpine AS node

LABEL fly_launch_runtime="NodeJS/Prisma"

# NodeJS/Prisma app lives here
WORKDIR /app

# Set production environment
ENV NODE_ENV=production

# Throw-away build stage to reduce size of final image
FROM node as build

# Install packages needed to build node modules
RUN apk add --no-cache python3 pkgconf build-base openssl

# Install node modules
COPY package.json package-lock.json .
RUN npm install --production=false

# Generate Prisma Client
COPY db ./db
RUN npx prisma generate

# Copy application code
COPY . .

# Remove development dependencies
RUN npm prune --production

# Final stage for app image
FROM node

# Copy built application
COPY --from=build /app /app

# Entrypoint prepares the database.
# Make sure to replace "docker-entrypoint" with the actual script you want to run.
COPY docker-entrypoint /app/docker-entrypoint
ENTRYPOINT ["/app/docker-entrypoint"]

# Start the server by default, this can be overwritten at runtime
CMD [ "npm", "run", "start" ]
# syntax = docker/dockerfile:1
# Adjust NODE_VERSION as desired
ARG NODE_VERSION=20.13.1
FROM node:${NODE_VERSION}-alpine AS node

LABEL fly_launch_runtime="NodeJS/Prisma"

# NodeJS/Prisma app lives here
WORKDIR /app

# Set production environment
ENV NODE_ENV=production

# Throw-away build stage to reduce size of final image
FROM node as build

# Install packages needed to build node modules
RUN apk add --no-cache python3 pkgconf build-base openssl

# Install node modules
COPY package.json package-lock.json .
RUN npm install --production=false

# Generate Prisma Client
COPY db ./db
RUN npx prisma generate

# Copy application code
COPY . .

# Remove development dependencies
RUN npm prune --production

# Final stage for app image
FROM node

# Copy built application
COPY --from=build /app /app

# Entrypoint prepares the database.
# Make sure to replace "docker-entrypoint" with the actual script you want to run.
COPY docker-entrypoint /app/docker-entrypoint
ENTRYPOINT ["/app/docker-entrypoint"]

# Start the server by default, this can be overwritten at runtime
CMD [ "npm", "run", "start" ]
Please replace "docker-entrypoint" with the actual script you want to run at the entrypoint. If the problem persists, please share any error messages or relevant code for further assistance. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @2euxs, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist: Perhaps try again in 15mins?
2euxs
2euxs14h ago
s
MEE6
MEE614h ago
Wohooo @2euxs, you just became a Waspeteer level 3!
Want results from more Discord servers?
Add your server