W
Wasp4mo ago
hadanator

Main.wasp in GH action

In going through the steps to convert to the wasp.ts, I ran the wasp ts-setup command, which added the devDep to my package.json for wasp-config. If I run wasp clean, I have to run npm install, and then wasp build, and everything builds fine. But when I try to deploy it to coolify with the example deploy.yml, then wasp build errors out for me in the github action saying:
🐝 --- Building wasp project... ---------------------------------------------------

[ Wasp ] main.wasp.ts(1,21): error TS2307: Cannot find module 'wasp-config' or its corresponding type declarations.
🐝 --- Building wasp project... ---------------------------------------------------

[ Wasp ] main.wasp.ts(1,21): error TS2307: Cannot find module 'wasp-config' or its corresponding type declarations.
I tried doing an npm install before wasp build in the gh action, and got the same error. I haven't been able to find anywhere referencing the actual line that gets added to the package.json, but it added this to mine: "wasp-config": "file:../../../.local/share/wasp-lang/0.16.3/data/packages/wasp-config" So I'm not sure if that's all correct or not from a deployment perspective. Everything works great locally.
11 Replies
kapa.ai
kapa.ai4mo ago
Hi @hadanator. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Based on the information in the knowledge sources, your issue seems related to how local file dependencies (like "wasp-config": "file:../../../.local/share/wasp-lang/0.16.3/data/packages/wasp-config") are handled in CI/CD environments such as GitHub Actions or Coolify. Key points from the sources: - Wasp projects now use a top-level package.json and node_modules, and there is an extra install step during wasp start to handle dependencies, but the handling of local file dependencies in CI is not explicitly documented in the sources provided Support project dependencies in Wasp. - There are known issues with missing dependencies during deployment, especially when dependencies are referenced as local file paths that exist only on the developer's machine and not in the CI/CD environment Missing commander npm package installation when deploying wasp app?. - The error you are seeing (Cannot find module 'wasp-config') is similar to other issues where modules generated or installed locally are not available in the deployment environment Issue with deploying my wasp app to fly.io. What’s likely happening: - The "file:../../../.local/share/wasp-lang/0.16.3/data/packages/wasp-config" path works locally because that file exists on your machine, but in the CI/CD environment, that path does not exist, so npm cannot install wasp-config, leading to the build error. What you can do: - The knowledge sources do not provide a direct solution for handling local file dependencies like wasp-config in CI/CD. However, based on the issues and discussions, you will need to ensure that wasp-config is available in your CI/CD environment, possibly by publishing it to a registry or ensuring it is copied into the build context in a way that npm can access it. Summary:
The knowledge sources confirm that local file dependencies can cause issues in CI/CD environments, and your experience matches known problems. However, they do not provide a specific, documented solution for handling wasp-config as a local file dependency during deployment. You may need to adjust your workflow to ensure wasp-config is available in the CI/CD environment, or consult the Wasp community for the latest best practices on this topic. If you need further help, consider opening an issue on the Wasp GitHub or asking in the Wasp Discord, as this is a nuanced deployment scenario not fully covered in the current documentation or issues. Let me know if you need help with a workaround or want to discuss possible solutions! ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @hadanator, 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?
hadanator
hadanatorOP4mo ago
If it makes a difference, that package version says 0.16.3, but in my main.wasp.ts I have the wasp version as ^0.16.0, and in my deploy.yml, I have WASP_VERSION: "0.16.0".
genyus
genyus4mo ago
The wasp ts-setup command adds the devDep to your package json based on the relative path of your local Wasp install to your app, but this path is invalid within the workflow runner environment, so you'll need to run the command again there after installing Wasp. Add this step to your workflow between the 'Install Wasp' and 'Build Wasp app' steps:
- name: Setup TS config
shell: bash
run: wasp ts-setup
- name: Setup TS config
shell: bash
run: wasp ts-setup
You should also set your WASP_VERSION environment variable to match your local Wasp version to avoid deploying a different version, which could lead to unexpected issues in production
hadanator
hadanatorOP4mo ago
Ok that's great stuff. As far as the wasp_version env var, what is the master definition of what my wasp version is? wasp --version doesn't give me anything. Is there another way to find out?
genyus
genyus4mo ago
Nearly there, the correct command is wasp version
hadanator
hadanatorOP4mo ago
ok awesome. Thanks!
MEE6
MEE64mo ago
Wohooo @hadanator, you just became a Waspeteer level 2!
Filip
Filip4mo ago
Need any more help with this @hadanator? The TS spec is still experimental so I'm more than happy to help soften the rough edgse. @genyus being the MVP as usual. Thanks!
hadanator
hadanatorOP4mo ago
Yeah thanks for checking back. The main issue is probably just around communication about what needs to happen after migrating to the ts config. i.e. currently need to npm install after wasp clean and before wasp build. If intended, the docs should say something about it, including on deployment (might not be necessary to communicate for deployment, idk). If it's not intended, then we might need a ticket for making sure it's not necessary to npm install after wasp clean. That's my 2c anyways. But it does look like you're getting the conversation going over here https://discord.com/channels/686873244791210014/1341575371572772864
Filip
Filip4mo ago
Yeah, you got it right. Always run wasp ts-setup after cleaning. This page has all the details: https://wasp.sh/docs/general/wasp-ts-config
Filip
Filip4mo ago
This banner in particular talks about reruning it after wasp clean
No description

Did you find this page helpful?