local deployments are non strict but deployments with fly are strict
../../../src/admin/UsersPage.tsx(261,22): error TS18046: 'error' is of type 'unknown'.
../../../src/admin/UsersPage.tsx(275,20): error TS18046: 'error' is of type 'unknown'.
../../../src/auth/hooks.ts(142,40): error TS7006: Parameter 'tx' implicitly has an 'any' type.
../../../src/chat/ChatPage.tsx(295,65): error TS7053: Element implicitly has an 'any' type because expression of type 'string' can't be used to index type '{ 'Study Assistant': { reminder: string; initialMessage: { content: string; role: string; provider: string; }; }; 'Essay Helper': { reminder: string; initialMessage: { content: string; role: string; provider: string; }; }; ... 5 more ...; 'Meeting Planner': { ...; }; }'.
No index signature with a parameter of type 'string' was found on type '{ 'Study Assistant': { reminder: string; initialMessage: { content: string; role: string; provider: string; }; }; 'Essay Helper': { reminder: string; initialMessage: { content: string; role: string; provider: string; }; }; ... 5 more ...; 'Meeting Planner': { ...; }; }'.
wasp start works fine locally but not when deploying with fly -- why?
14 Replies
Hi @A³Learn. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
The difference in TypeScript strictness between local development (wasp start) and deployment with Fly (wasp deploy fly deploy) is a known issue in the Wasp ecosystem. Locally, Wasp's dev environment is more permissive and may not enforce all TypeScript checks, allowing code with certain type errors to run. However, during deployment—especially with Fly.io—Wasp performs a stricter build, which includes running TypeScript in a way that surfaces errors that were ignored or not enforced locally.
This stricter behavior during deployment can result in errors like:
- TS18046: 'error' is of type 'unknown'.
- TS7006: Parameter implicitly has an 'any' type.
- TS7053: Element implicitly has an 'any' type because expression of type 'string' can't be used to index type...
This is confirmed by community discussions, where users have noted that code working locally can fail during deployment due to stricter TypeScript checks. The stricter build process is intentional to ensure production code is type-safe and robust, but it can be surprising if your local dev environment doesn't catch these issues first.
To resolve this, you should fix the TypeScript errors reported during deployment. For example:
- Explicitly type error parameters (e.g., error: unknown).
- Add index signatures or use type assertions where needed.
- Provide types for parameters that are implicitly any.
There is no explicit documentation in the provided sources about configuring the strictness level for local vs. production builds, but the behavior and its impact are discussed in community threads and issues, confirming that this is the current state of Wasp's build process for Fly deploymentsDiscord: Issue with deploying my wasp app to fly.io.
In summary:
Local builds are more permissive, but Fly deployments enforce stricter TypeScript checks, so you must resolve all type errors for successful deployment. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @A³Learn, 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?
Local builds are more permissive, but Fly deployments enforce stricter TypeScript checks, so you must resolve all type errors for successful deployment. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @A³Learn, 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?
oh that's annoying is there a github issue about this? @kapa.ai
Let me check the knowledge base for you again. One moment! :books:
----------------------
I'm sorry, but the knowledge sources do not mention a specific GitHub issue that tracks the difference in TypeScript strictness between local development and Fly deployments in Wasp. While there are related discussions about TypeScript configuration and deployment errors, none of the provided sources explicitly reference an issue dedicated to this strictness mismatch.
If this is a significant pain point, you might consider opening a new issue on the Wasp GitHub repository to bring it to the maintainers' attention.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Sorry @A³Learn, 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?
Uhm that's confusing -- I usually circumvented this with adding
// @ts-ignore
in front of all my files - that's also not working when I deploy to fly.io
@kapa.ai has something changed recently or why is it failing when I deploy to fly.io?
Let me check the knowledge base for you again. One moment! :books:
----------------------
Based on the knowledge sources, there have been recent changes and bug fixes related to deployment and TypeScript handling in Wasp, especially around Fly.io deployments. For example, a bug related to missing imports and stricter TypeScript checks was fixed in Wasp version 0.12.4. Users have reported that upgrading to at least version 0.12.4 resolved certain deployment issues that did not appear during local development but surfaced during deployment to Fly.io. This suggests that recent updates have made the deployment process stricter or fixed inconsistencies between local and production builds.
If you are experiencing new failures when deploying to Fly.io, it is recommended to:
1. Check your Wasp version: Make sure you are running at least Wasp 0.12.4, as earlier versions had known issues with deployment strictness and missing imports.
2. Upgrade if needed: You can upgrade Wasp with the following command:
3. Review TypeScript errors: The deployment process now enforces stricter TypeScript checks, so you may need to fix type errors that were previously ignored locally.
For more details, see the discussion here: Discord: Issue with deploying my wasp app to fly.io.
In summary, yes, there have been recent changes that affect deployment to Fly.io, and upgrading Wasp and fixing TypeScript errors should resolve most issues.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Sorry @A³Learn, 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 by using Cursor agent mode and it parsing through 20 files and fixing the typescript errors, but a curious problem. Some of these functions I implemented from my prior project and I didn't have these errors! Also very weird that the local build ran without any issues
Hey @A³Learn, do you mind sharing your project with me privately? I want to get to the bottom of this
sent via pm
Great, will take a look soon
tsc --build && vite build../../../src/chat/ChatArea.tsx(818,37): error TS7053: Element implicitly has an 'any' type because expression of type 'string' can't be used to index type '{ web_search: ForwardRefExoticComponent<Omit<SVGProps<SVGSVGElement>, "ref"> & { title?: string | undefined; titleId?: string | undefined; } & RefAttributes<SVGSVGElement>>; ... 5 more ...; send_email: ForwardRefExoticComponent<...>; } Hmm I still don't understand the problem, the only thing I've realized is my github action works https://github.com/wasp-lang/deploy-action/blob/main/action.yml But running wasp deploy fly deploy on a local deployment to deploy on fly doesn't work and gives me these minor typescript errors
GitHub
deploy-action/action.yml at main · wasp-lang/deploy-action
Github Action to deploy with Wasp to Fly.io. Contribute to wasp-lang/deploy-action development by creating an account on GitHub.
Hey @A³Learn, this is a regular typescript error, unrelated to Wasp.
I'm gussing your IDE is reporting it, so you can go about it as you would solving any typescript error. If you share the code here, maybe I can help
ah so like I can't run because it fails and says I need to fix these errors.
When I deploy via my github action, I don't get this error and it deploys to my server
Is your IDE reporting the error?
let me send you the exact error next time, sorry had a database migration issue and that cmd history is far gone