How do i fix this error

❌ --- [Error] Your wasp project failed to compile: ------------------------------- - /projects/studyguided/main.wasp @ 10:17-22 Type error: Expected type: entity (declaration type) Actual type: string -> For dictionary field 'auth': -> For dictionary field 'userEntity' 9 | auth: { 10 | userEntity: "User", 11 | methods: { ❌ --- [Error] Compilation of wasp project failed: -------------------------------- 1 errors found
4 Replies
kapa.ai
kapa.ai2mo ago
Hi @real titan. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- The error message indicates that the userEntity field in your auth dictionary is expected to be an entity declaration type, but a string was provided instead. In Wasp, you need to declare a userEntity for all auth methods (social or otherwise). This field tells Wasp which Entity represents the user. Here's what the correct setup looks like:
app myApp {
wasp: {
version: "^0.13.0"
},
title: "My App",
auth: {
userEntity: User,
methods: {
google: {}
},
onAuthFailedRedirectTo: "/login"
},
}

entity User {=psl
id Int @id @default(autoincrement())
//...
psl=}
app myApp {
wasp: {
version: "^0.13.0"
},
title: "My App",
auth: {
userEntity: User,
methods: {
google: {}
},
onAuthFailedRedirectTo: "/login"
},
}

entity User {=psl
id Int @id @default(autoincrement())
//...
psl=}
In the above code, User is an entity, not a string. You should replace "User" with User in your auth dictionary. For more information, you can refer to the Wasp documentation on User Entity (https://wasp-lang.dev/docs/auth/social-auth/overview#user-entity). ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @real titan, 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?
real titan
real titanOP2mo ago
where is this found so i can fix it ❌ --- [Error] Your wasp project failed to compile: ------------------------------- - /projects/studyguided/main.wasp @ 30:14-19 Type error: Expected type: entity (declaration type) Actual type: string -> For dictionary field 'entities': -> In list 29 | fn: import { createNote } from "@src/actions.js", 30 | entities: ["Note"] 31 | } ❌ --- [Error] Compilation of wasp project failed: -------------------------------- 1 errors found
MEE6
MEE62mo ago
Wohooo @real titan, you just became a Waspeteer level 1!
miho
miho2mo ago
I'd advise going through Wasp's tutorial to get the hang of Wasp basics: https://wasp-lang.dev/docs/tutorial/create The issue you are facing here is that you are using strings instead of entity name e.g. "Note" vs. Note, the difference is in the quotes.
1. Creating a New Project | Wasp
You'll need to have the latest version of Wasp installed locally to follow this tutorial. If you haven't installed it yet, check out the QuickStart guide!
Want results from more Discord servers?
Add your server