You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Yesterday I was dealing with a strange issue when deploying to GCP cloud.
I created a basic adonis app using "npm init adonisjs@latest -- -K=api --db=postgres" and added a few routes. I then wanted to deploy this app to google cloud run. Building the docker image locally works fine, but when I try it on GCP cloud build I get the following error: "Step #0 - "Build": start/kernel.ts(32,34): error TS2307: Cannot find module '#exceptions/handler' or its corresponding type declarations."
Workaround: I found that when I commented out the line in kernel.ts server.errorHandler(() => import('#exceptions/handler')) it built successfully(meaning the other module imports worked fine). Then I decided to move the handler file to another folder "exception,"(without an 's' at the end) and added a map "#exception/": "./app/exception/.js" in my package.json, this also worked fine.
I am not sure what it is about a folder named exceptions in combination with the GCP cloud build environment that is causing this. Just wanted to raise attention to this.
The dockerfile I am using is
FROM node:22 AS base
FROM base AS production-deps
WORKDIR /app
ADD package.json package-lock.json ./
RUN npm ci --omit=dev
FROM base AS build
WORKDIR /app
COPY --from=deps /app/node_modules /app/node_modules
ADD . .
RUN node ace build
FROM base
ENV NODE_ENV=production
WORKDIR /app
COPY --from=production-deps /app/node_modules /app/node_modules
COPY --from=build /app/build /app
CMD ["node", "./bin/server.js"]
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Yesterday I was dealing with a strange issue when deploying to GCP cloud.
I created a basic adonis app using "npm init adonisjs@latest -- -K=api --db=postgres" and added a few routes. I then wanted to deploy this app to google cloud run. Building the docker image locally works fine, but when I try it on GCP cloud build I get the following error: "Step #0 - "Build": start/kernel.ts(32,34): error TS2307: Cannot find module '#exceptions/handler' or its corresponding type declarations."
Workaround: I found that when I commented out the line in kernel.ts server.errorHandler(() => import('#exceptions/handler')) it built successfully(meaning the other module imports worked fine). Then I decided to move the handler file to another folder "exception,"(without an 's' at the end) and added a map
"#exception/": "./app/exception/.js"
in my package.json, this also worked fine.I am not sure what it is about a folder named exceptions in combination with the GCP cloud build environment that is causing this. Just wanted to raise attention to this.
The dockerfile I am using is
Beta Was this translation helpful? Give feedback.
All reactions