web/versioned_docs/version-0.21/migration-guides/migrate-from-0-15-to-0-16.md
Wasp now uses Zod to validate environment variables, allowing it to fail faster if something is misconfigured. This means you’ll get more relevant error messages when running your app with incorrect env variables.
You can also use Zod to validate your own environment variables. Here’s an example:
// src/env.ts
import * as z from 'zod'
import { defineEnvValidationSchema } from 'wasp/env'
export const serverEnvValidationSchema = defineEnvValidationSchema(
z.object({
STRIPE_API_KEY: z.string({
required_error: 'STRIPE_API_KEY is required.',
}),
})
)
// main.wasp
app myApp {
...
server: {
envValidationSchema: import { serverEnvValidationSchema } from "@src/env",
},
}
Read more about it in the env variables section of the docs.
To migrate your Wasp app from 0.15.X to 0.16.X, follow these steps:
Update the version field in your Wasp file to ^0.16.0:
app MyApp {
wasp: {
// highlight-next-line
version: "^0.16.0"
},
}
If you're using Wasp's new TS config, you must
also rerun the wasp ts-setup command in your project. This command updates
the path for the wasp-config package in your package.json.
package.json fileMake sure to explicitly add react-dom and react-router-dom to your package.json file:
{
"dependencies": {
// highlight-start
"react-dom": "^18.2.0",
"react-router-dom": "^6.26.2"
// highlight-end
}
}
tsconfig.json fileWasp now internally works with TypeScript project references, so you'll have to
update your tsconfig.json (Wasp will validate your tsconfig.json and warn
you if you forget something). Here are all the properties you must change:
{
"compilerOptions": {
// ...
"composite": true,
"skipLibCheck": true,
"outDir": ".wasp/out/user"
},
"include": ["src"]
}
That's it!
You should now be able to run your app with the new Wasp 0.16.0.