wasp deploy fly deploy has caused importing issues
i ran wasp clean and wasp start, when doing so i get lots of import errors, and then build fails with. Any Ideas?
[ Wasp ] ext-src/landing-page/contentSections.ts(2,24): error TS2307: Cannot find module '../../.wasp/out/sdk/wasp/client/router' or its corresponding type declarations.

11 Replies
Hi @Vladimir. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
Wohooo @Vladimir, you just became a Waspeteer level 1!
----------------------
Based on the knowledge sources provided, it appears there have been some issues with the
wasp deploy fly deploy
command causing importing problems. Here's what I can tell you:
1. Version-related issue: There was a problem with Wasp version 0.12.3 where it couldn't find the path to wasp/auth/types
during deployment, even though it worked fine on localhost. This was fixed in version 0.12.4. If you're experiencing this issue, you should upgrade to at least version 0.12.4 of Wasp. Discord support thread
2. Deployment process: When you run wasp deploy fly deploy
, Wasp builds a fresh build in the .wasp/build
directory. This means that any manual changes made to the .wasp/out
files during development won't be deployed. Discord support thread
3. Error messages: There's an ongoing issue with error messages reported by the framework code after restructuring. Some error messages are not easy to decipher, especially when importing JS paths that don't exist. For example, if a file doesn't exist or doesn't export the expected member, you might get confusing error messages. Github Issue
To resolve these issues, you can try the following:
1. Upgrade your Wasp version to at least 0.12.4 by running:
2. Double-check your import statements and make sure the files and exported members exist.
3. If you're still experiencing issues, you may need to modify the output code from Wasp to get custom behavior. However, this can be tricky and might require additional steps during deployment.
If these steps don't resolve your issue, you may need to provide more specific details about the importing problems you're encountering for further assistance.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Sorry @Vladimir, 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?@kapa.ai after deploying all the import statements
import { type DailyStats } from 'wasp/entities';
import { type DailyStatsJob } from 'wasp/server/jobs';
got an error: Cannot find module 'wasp/server/jobs' or its corresponding type declarations.
Let me check the knowledge base for you again. One moment! :books:
----------------------
Based on the information provided in the knowledge sources, I can offer some insights about the import statements you're encountering after deployment:
1. Import structure changes: Wasp has undergone some changes in its import structure. The import statements you're seeing (
import { type DailyStats } from 'wasp/entities'
and import { type DailyStatsJob } from 'wasp/server/jobs'
) are consistent with the newer import structure used in Wasp versions 0.12.0 and later. Docs: Migration from 0.11.X to 0.12.X
2. Server-side imports: The import import { type DailyStatsJob } from 'wasp/server/jobs'
is specifically for server-side code. Make sure this import is only used in your server-side files, not in client-side code. Docs: Advanced > Recurring Jobs > JavaScript API
3. Entity imports: The import import { type DailyStats } from 'wasp/entities'
is used to import entity types. This is correct for accessing entity types in your code. Github Issue: Improve access to Entities in Jobs
4. Deployment considerations: When you deploy your Wasp app, it generates a fresh build in the .wasp/build
directory. This means that the deployed code might have slightly different import paths compared to your development environment. Discord support thread
If you're experiencing any issues with these imports after deployment, you should:
1. Ensure you're using the latest version of Wasp (at least 0.12.4) to avoid known import-related bugs.
2. Double-check that you're using these imports in the correct context (server-side vs. client-side).
3. Verify that your main.wasp
file correctly declares the entities and jobs you're trying to import.
If you continue to face problems with these imports after deployment, you may need to provide more specific error messages or details about your project structure for further assistance.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Sorry @Vladimir, 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?@kapa.ai ai after deploying all the import statements
import { type DailyStats } from 'wasp/entities';
import { type DailyStatsJob } from 'wasp/server/jobs';
got an error: Cannot find module 'wasp/server/jobs' or its corresponding type declarations.
Let me check the knowledge base for you again. One moment! :books:
----------------------
Based on the information provided in the knowledge sources and your specific error message, it appears you're encountering a common issue with Wasp imports after deployment. Let's address this problem:
1. Version Check: First, ensure you're using Wasp version 0.12.4 or later. There was a bug fix related to imports in this version. You can check your version by running
wasp version
and upgrade if necessary using:
Discord support thread
2. Import Location: The error suggests that the import import { type DailyStatsJob } from 'wasp/server/jobs'
is causing issues. Make sure this import is only used in server-side code, not in client-side files. Docs: Advanced > Recurring Jobs > JavaScript API
3. Build Process: When deploying, Wasp generates a fresh build in the .wasp/build
directory. This means that any manual changes to .wasp/out
files during development won't be reflected in the deployed version. Discord support thread
4. TypeScript Configuration: If you're using TypeScript, ensure your tsconfig.json
is correctly set up to recognize the Wasp imports. You might need to adjust the paths
in your TypeScript configuration to include the Wasp-generated files. Github Issue: RFC: Wasp IDE Integration
5. Environment Variables: Double-check that all necessary environment variables are correctly set in your deployment environment, as missing variables can sometimes cause unexpected import issues.
If you've verified all these points and are still encountering the error, you might need to:
1. Run wasp clean
and then wasp start
to regenerate the Wasp files.
2. If the problem persists, try to create a minimal reproducible example of your project that causes this error and share it with the Wasp team for further investigation.
Remember, the error "Cannot find module 'wasp/server/jobs' or its corresponding type declarations" specifically points to issues with server-side imports, so focus on your server-side code and deployment configuration when troubleshooting.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Sorry @Vladimir, 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?@kapa.ai where do i fing ext-src folder
[ Wasp ] ext-src/landing-page/contentSections.ts(2,24): error TS2307: Cannot find module '../../.wasp/out/sdk/wasp/client/router' or its corresponding type declarations.
@kapa.ai a.ai where do i fing ext-src folder
[ Wasp ] ext-src/landing-page/contentSections.ts(2,24): error TS2307: Cannot find module '../../.wasp/out/sdk/wasp/client/router' or its corresponding type declarations.
Let me check the knowledge base for you again. One moment! :books:
----------------------
Based on the information provided in the knowledge sources and your specific error message, I can provide some insights about the
ext-src
folder and the error you're encountering:
1. Location of ext-src
: The ext-src
folder is typically located in the root directory of your Wasp project. It's where you place your custom JavaScript/TypeScript code that Wasp will use in the generated project. Github Issue: Rethinking Wasp code organization
2. Error context: The error you're seeing suggests that there's an issue with importing from the Wasp SDK. Specifically, it can't find the module '../../.wasp/out/sdk/wasp/client/router'
. This could be due to a few reasons:
a. The Wasp SDK might not be properly generated or linked.
b. There might be a mismatch between your project structure and what Wasp expects.
3. Possible solutions:
a. First, try running wasp clean
followed by wasp start
. This will regenerate the Wasp files and might resolve the import issue. Discord support thread
b. Make sure you're using the latest version of Wasp. You can check your version with wasp version
and update if necessary.
c. Verify that your main.wasp
file is correctly configured and that you haven't accidentally modified any files in the .wasp
directory.
d. If you're using an IDE like VS Code, you might need to restart it or reload the window to recognize the newly generated files.
4. Project structure: Remember that Wasp generates code in the .wasp
directory, and your custom code should be in the root directory (including the ext-src
folder). Don't modify files in the .wasp
directory directly. Github Issue: Figure out Wasp's node_modules
story
If these steps don't resolve your issue, you might need to provide more details about your project structure and the contents of your main.wasp
file for further assistance.
Github Issue: Rethinking Wasp code organization
Discord support thread
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Sorry @Vladimir, 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?Solved. import statement for some reason was importing from .wasp/... and had to be from 'wasp/client/router'
ah nice. Glad you got it working!