W
Wasp-lang•5mo ago
Francesco

Error when trying to add authentication

Hiya, I'm following the steps outlined in the Wasp tutorial to create a Todo app. I got to the final step, adding authentication (https://wasp-lang.dev/docs/tutorial/auth). I created a user entity successfully. However, in the next step (adding auth to the project), when I try to update the database schema by typing "wasp db migrate-dev" in my terminal, I get an error message saying "Complication of wasp project failed" (see attached).
No description
3 Replies
kapa.ai
kapa.ai•5mo ago
Hi @Francesco. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- I'm sorry to hear that you're encountering an error. Based on the information provided, it's hard to pinpoint the exact issue without more details about the error message you're seeing. However, here are a few things you could check: 1. Syntax errors in your main.wasp file: Ensure that you've correctly added the auth-related code to your main.wasp file as shown in the tutorial (https://wasp-lang.dev/docs/tutorial/auth). Here's the relevant code snippet for reference:
app TodoApp {
wasp: {
version: "^0.13.0"
},
title: "TodoApp",
auth: {
// Tells Wasp which entity to use for storing users.
userEntity: User,
methods: {
// Enable username and password auth.
usernameAndPassword: {}
},
// We'll see how this is used in a bit.
onAuthFailedRedirectTo: "/login"
}
}
app TodoApp {
wasp: {
version: "^0.13.0"
},
title: "TodoApp",
auth: {
// Tells Wasp which entity to use for storing users.
userEntity: User,
methods: {
// Enable username and password auth.
usernameAndPassword: {}
},
// We'll see how this is used in a bit.
onAuthFailedRedirectTo: "/login"
}
}
2. Database migration issues: If you've made changes to your entities, you need to run wasp db migrate-dev to update the database schema. If this command fails, it could be due to a variety of reasons. For instance, there have been reported issues (https://github.com/wasp-lang/wasp/issues/597) with the migration process requiring the command to be run twice. If you're seeing a specific error message related to the migration, that could help narrow down the problem. 3. Compatibility issues: Ensure that you're using a compatible version of Wasp. If you've recently upgraded Wasp, you might need to migrate your auth system (https://wasp-lang.dev/docs/migrate-from-0-11-to-0-12#2-cleanup-the-old-auth-system) as per the instructions in the Wasp documentation. If none of these suggestions help, could you please provide more details about the error message you're seeing? That would help in diagnosing the issue. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @Francesco, 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?
Francesco
FrancescoOP•5mo ago
Ah, I found a syntax error in my code. Thanks for pointing me to it!
miho
miho•5mo ago
Nice đź‘Ť
Want results from more Discord servers?
Add your server