W
Wasp2mo ago
ralph

error TS5083: Cannot read file '/app/tsconfig.json' when attempting to deploy to railway

Upgraded to 0.17, made the change to tsconfig.json as outlined in the migration guide and I'm getting that error during this step in deployment: ✔ Generated Prisma Client (v5.19.1) to ./../../../node_modules/@prisma/client in 158ms Start by importing your Prisma Client (See: http://pris.ly/d/importing-client) Tip: Want to turn off tips and other hints? https://pris.ly/tip-4-nohints [server-builder 10/11] RUN cd ./.wasp/build/server && npx prisma generate --schema='../db/schema.prisma' [server-builder 11/11] RUN cd ./.wasp/build/server && npm run bundle
server@0.0.0 bundle tsc --build && rollup --config --silent
error TS5083: Cannot read file '/app/tsconfig.json'.
20 Replies
kapa.ai
kapa.ai2mo ago
Hi @ralph. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- The error TS5083: Cannot read file '/app/tsconfig.json' during deployment to Railway indicates that the TypeScript compiler (tsc) is looking for a tsconfig.json at the root of your deployed app, but it cannot find it. Based on the knowledge sources, here are some key points: - In Wasp 0.12.0 and later, there is a single tsconfig.json at the project root, and it is important for both IDE support and compilation. Wasp expects this file to exist and be correct, and it should be included in your project and deployment artifacts. If it is missing, you will encounter errors like the one you are seeing. Wasp should generate this file during project creation, but if it is deleted or not present, you need to restore or recreate it. There is ongoing discussion about Wasp managing this file and regenerating it if missing, but as of now, you need to ensure it is present yourself Support custom TypeScript configuration Ensure "user" tsconfig.json files exist and are correct. - The migration guide for 0.12.x and later also emphasizes the importance of having the correct tsconfig.json at the root of your project after migration Migrating your project to the new structure. What you should do: 1. Make sure that tsconfig.json exists at the root of your project (not just in src/). 2. If it is missing, you can create a new Wasp project (wasp new <project>) and copy the generated tsconfig.json to your current project, or refer to the migration guide for the correct structure. 3. Ensure that your deployment process (e.g., Dockerfile, Railway config) copies tsconfig.json to the deployed app's root directory. If you follow these steps, the TypeScript compiler should be able to find tsconfig.json and the error should be resolved. If you have already made changes to tsconfig.json as outlined in the migration guide, double-check that it is present in your repository and included in the build context for deployment. If you need more details on the project structure, see the project structure documentation. If the problem persists after ensuring tsconfig.json is present, please provide more details about your deployment setup. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @ralph, 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?
ralph
ralphOP2mo ago
@kapa.ai it exists in my /app like it has existed there before... Deployment to railway worked fine before updated to 0.17
kapa.ai
kapa.ai2mo ago
Let me check the knowledge base for you again. One moment! :books:
MEE6
MEE62mo ago
Wohooo @ralph, you just became a Waspeteer level 2!
kapa.ai
kapa.ai2mo ago
---------------------- Given your tsconfig.json exists at /app and deployment to Railway worked before upgrading to Wasp 0.17, but now you see error TS5083: Cannot read file '/app/tsconfig.json', here’s what is known from the knowledge sources: - Wasp expects a single tsconfig.json at the project root since version 0.12.0, and this file is important for both IDE support and compilation. If it is missing or not correctly included in the build context, you will see errors like this Ensure "user" tsconfig.json files exist and are correct. - The migration guide for 0.12.x and later emphasizes ensuring the correct tsconfig.json at the root after migration Migrating your project to the new structure. - There is no explicit mention in the knowledge sources of a change in Wasp 0.17 that would alter how tsconfig.json is located or used during deployment. What is not clear from the knowledge sources: - There is no information about a new requirement or breaking change in Wasp 0.17 regarding tsconfig.json or its handling during deployment. - There is no mention of a known issue with Railway deployment and tsconfig.json in Wasp 0.17. What you can try, based on the sources: - Double-check that tsconfig.json is not excluded by your .gitignore or .dockerignore (if using Docker for deployment). - Ensure that your deployment process copies tsconfig.json to the correct location in the build context. - If you have customized your tsconfig.json, try replacing it with the default one generated by a new Wasp project to rule out config issues. If all of the above checks out and the error persists, the knowledge sources do not provide enough information to explain why this is happening specifically after upgrading to Wasp 0.17. There may be a new or undocumented change, or an issue with the deployment process that is not covered in the available documentation. If you need further help, you may want to open an issue on the Wasp GitHub or ask in the Wasp Discord, providing details about your project structure and deployment setup. I'm sorry I can't provide a more specific answer based on the current knowledge sources. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @ralph, 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?
ralph
ralphOP2mo ago
will have to wait for the big boys to try my question then @kapa.ai does this context help at all? added 783 packages, and audited 785 packages in 13s 147 packages are looking for funding run npm fund for details 8 vulnerabilities (3 low, 5 moderate) To address issues that do not require attention, run: npm audit fix To address all issues (including breaking changes), run: npm audit fix --force Run npm audit for details. npm notice npm notice New major version of npm available! 9.6.4 -> 11.4.2 npm notice Changelog: https://github.com/npm/cli/releases/tag/v11.4.2 npm notice Run npm install -g npm@11.4.2 to update! npm notice added 145 packages, and audited 146 packages in 14s 28 packages are looking for funding run npm fund for details 3 high severity vulnerabilities To address all issues (including breaking changes), run: npm audit fix --force Run npm audit for details. [server-builder 8/11] RUN npm install && cd ./.wasp/build/server && npm install [server-builder 9/11] COPY db/schema.prisma ./.wasp/build/db/ [server-builder 9/11] COPY db/schema.prisma ./.wasp/build/db/ [server-builder 10/11] RUN cd ./.wasp/build/server && npx prisma generate --schema='../db/schema.prisma' Prisma schema loaded from ../db/schema.prisma ✔ Generated Prisma Client (v5.19.1) to ./../../../node_modules/@prisma/client in 158ms Start by importing your Prisma Client (See: http://pris.ly/d/importing-client) Tip: Want to turn off tips and other hints? https://pris.ly/tip-4-nohints [server-builder 10/11] RUN cd ./.wasp/build/server && npx prisma generate --schema='../db/schema.prisma' [server-builder 11/11] RUN cd ./.wasp/build/server && npm run bundle
server@0.0.0 bundle tsc --build && rollup --config --silent
error TS5083: Cannot read file '/app/tsconfig.json'. Deploy failed 🚀 Error deploying service "production-server", please check the command output. Waiting for the debugger to disconnect...
kapa.ai
kapa.ai2mo ago
Let me check the knowledge base for you again. One moment! :books: ---------------------- Thank you for providing the additional context. Based on the knowledge sources, the new information about npm, vulnerabilities, and package installation does not directly explain the TS5083: Cannot read file '/app/tsconfig.json' error. The knowledge sources confirm that: - Wasp expects a single tsconfig.json at the project root for both IDE support and compilation since version 0.12.0. If this file is missing or not correctly included in the build context, TypeScript will fail with the error you are seeing Ensure "user" tsconfig.json files exist and are correct. - There is no mention in the knowledge sources of npm version, vulnerabilities, or the npm install process affecting the presence or reading of tsconfig.json. - The error occurs during the npm run bundle step, which runs tsc --build. This step requires tsconfig.json to be present at /app in the deployed environment. Summary:
The additional npm/audit output does not provide new insight into the root cause of the tsconfig.json error. The knowledge sources do not contain enough information to explain why this is happening after upgrading to Wasp 0.17, especially if your tsconfig.json is present at the project root and was working before. If you have confirmed that tsconfig.json is present in your project and included in the deployment context, but the error persists, the knowledge sources do not provide further troubleshooting steps specific to this scenario. You may need to seek help from the Wasp community or GitHub issues for more targeted support. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @ralph, 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?
ralph
ralphOP2mo ago
for context I deployed manually using railway before on version 0.16.7 and tried to use the same services
miho
miho2mo ago
Have you tried doing wasp clean and then deploying the app? Did you do any Dockerfile customisation?
ralph
ralphOP2mo ago
no sir, wasp cleaned so many times gave up and downgraded back to 0.16.7 and it worked when I undid all the migration stuff could be a result of deploying a 0.16.7 and then trying to use the same service to deploy a 0.17 (maybe the tsconfig was cached but that seems silly) (using the old manual railway deployment instructions)
miho
miho2mo ago
Are you using the main.wasp file or main.wasp.ts file? If you can, please share a zip of your project in the DMs so I can try it as well and see what happens 🙂
ralph
ralphOP2mo ago
if u send me some swag 100% jk working on it now
miho
miho2mo ago
First error I get is that you are missing these 3 files from your project, did you delete them?
No description
ralph
ralphOP2mo ago
they're there I promise! 😦
miho
miho2mo ago
Hm, can you repack the project and send it again 😄 for me the e.g. NavBar.tsx file is empty
ralph
ralphOP2mo ago
sent 🙂
MEE6
MEE62mo ago
Wohooo @ralph, you just became a Waspeteer level 3!
miho
miho2mo ago
Did you do any Dockerfile customisation?
I asked this earlier, and now I see that it's the case. So, when you do custom Dockerfile, you have to check for each version if changed the Dockerfile in any way e.g. going to .wasp/out/Dockerfile and seeing the contents. You are missing one line we added in 0.17.0 COPY tsconfig*.json .
No description
miho
miho2mo ago
Here's the full diff between 0.16.0 and 0.17.0:
diff --git a/waspc/data/Generator/templates/Dockerfile b/waspc/data/Generator/templates/Dockerfile
index f4e271e05..67712b296 100644
--- a/waspc/data/Generator/templates/Dockerfile
+++ b/waspc/data/Generator/templates/Dockerfile
@@ -33,6 +33,7 @@ WORKDIR /app
COPY src ./src
COPY package.json .
COPY package-lock.json .
+COPY tsconfig*.json .
COPY server .wasp/build/server
COPY sdk .wasp/out/sdk
# Install npm packages, resulting in node_modules/.
@@ -50,14 +51,11 @@ RUN cd .wasp/build/server && npm run bundle
FROM base AS server-production
# In case they want to use python3 in their app.
RUN apk add --no-cache python3
-ENV NODE_ENV production
+ENV NODE_ENV=production
WORKDIR /app
# Copying the top level 'node_modules' because it contains the Prisma packages
# necessary for migrating the database.
COPY --from=server-builder /app/node_modules ./node_modules
-# Copying the SDK because the server bundle doesn't bundle the SDK
-# and references the 'wasp' package.
-COPY --from=server-builder /app/.wasp/out/sdk .wasp/out/sdk
# Copying 'server/node_modules' because we require dotenv package to
# load environment variables
# TODO: replace dotenv with native Node.js environment variable loading
diff --git a/waspc/data/Generator/templates/Dockerfile b/waspc/data/Generator/templates/Dockerfile
index f4e271e05..67712b296 100644
--- a/waspc/data/Generator/templates/Dockerfile
+++ b/waspc/data/Generator/templates/Dockerfile
@@ -33,6 +33,7 @@ WORKDIR /app
COPY src ./src
COPY package.json .
COPY package-lock.json .
+COPY tsconfig*.json .
COPY server .wasp/build/server
COPY sdk .wasp/out/sdk
# Install npm packages, resulting in node_modules/.
@@ -50,14 +51,11 @@ RUN cd .wasp/build/server && npm run bundle
FROM base AS server-production
# In case they want to use python3 in their app.
RUN apk add --no-cache python3
-ENV NODE_ENV production
+ENV NODE_ENV=production
WORKDIR /app
# Copying the top level 'node_modules' because it contains the Prisma packages
# necessary for migrating the database.
COPY --from=server-builder /app/node_modules ./node_modules
-# Copying the SDK because the server bundle doesn't bundle the SDK
-# and references the 'wasp' package.
-COPY --from=server-builder /app/.wasp/out/sdk .wasp/out/sdk
# Copying 'server/node_modules' because we require dotenv package to
# load environment variables
# TODO: replace dotenv with native Node.js environment variable loading
miho
miho2mo ago
I think it would be useful for Wasp to tell you stuff like this if possible (if the Dockerfile is missing important lines). Created an issue for us to consider this: https://github.com/wasp-lang/wasp/issues/3008
GitHub
Validate user defined custom Dockerfile · Issue #3008 · wasp-la...
Motivated by this Discord thread: https://discord.com/channels/686873244791210014/1396259947305631824/1398223811031208017 We allow users to override the Wasp Dockerfile with their custom commands. ...

Did you find this page helpful?