wasp db migrate-dev Error
wasp db migrate-dev
š --- Compiling wasp project... --------------------------------------------------
ā --- [Error] Your wasp project failed to compile: -------------------------------
- /home/jphj/rapid-fm/main.wasp @ 21:3-10
Parse error:
Unexpected token: password
Expected one of the following tokens instead: '}',','
20 | email: String
21 | password: String
22 | stationRole: String
- /home/jphj/rapid-fm/main.wasp @ 21:11
Parse error:
Unexpected token: :
Expected one of the following tokens instead: <identifier>
20 | email: String
21 | password: String
22 | stationRole: String
- /home/jphj/rapid-fm/main.wasp @ 22:14
Parse error:
Unexpected token: :
Expected one of the following tokens instead: '(','[','{','import','true','false',<string>,<number>,<number>,'{=',<identifier>
21 | password: String
22 | stationRole: String
23 | djs: [Dj] // Correct syntax for array of related entities
- /home/jphj/rapid-fm/main.wasp @ 23:6
Parse error:
Unexpected token: :
Expected one of the following tokens instead: '(','[','{','import','true','false',<string>,<number>,<number>,'{=',<identifier>
22 | stationRole: String
23 | djs: [Dj] // Correct syntax for array of related entities
24 | }
- /home/jphj/rapid-fm/main.wasp @ 23:8
Parse error:
Unexpected token: [
Expected one of the following tokens instead: <identifier>,<eof>
22 | stationRole: String
23 | djs: [Dj] // Correct syntax for array of related entities
24 | }
- /home/jphj/rapid-fm/main.wasp @ 23:9-10
Parse error:
Unexpected token: Dj
Expected one of the following tokens instead: <eof>
22 | stationRole: String
23 | djs: [Dj] // Correct syntax for array of related entities
24 | }
ā --- [Error] Compilation of wasp project failed: --------------------------------
6 errors found
wasp db migrate-dev
š --- Compiling wasp project... --------------------------------------------------
ā --- [Error] Your wasp project failed to compile: -------------------------------
- /home/jphj/rapid-fm/main.wasp @ 21:3-10
Parse error:
Unexpected token: password
Expected one of the following tokens instead: '}',','
20 | email: String
21 | password: String
22 | stationRole: String
- /home/jphj/rapid-fm/main.wasp @ 21:11
Parse error:
Unexpected token: :
Expected one of the following tokens instead: <identifier>
20 | email: String
21 | password: String
22 | stationRole: String
- /home/jphj/rapid-fm/main.wasp @ 22:14
Parse error:
Unexpected token: :
Expected one of the following tokens instead: '(','[','{','import','true','false',<string>,<number>,<number>,'{=',<identifier>
21 | password: String
22 | stationRole: String
23 | djs: [Dj] // Correct syntax for array of related entities
- /home/jphj/rapid-fm/main.wasp @ 23:6
Parse error:
Unexpected token: :
Expected one of the following tokens instead: '(','[','{','import','true','false',<string>,<number>,<number>,'{=',<identifier>
22 | stationRole: String
23 | djs: [Dj] // Correct syntax for array of related entities
24 | }
- /home/jphj/rapid-fm/main.wasp @ 23:8
Parse error:
Unexpected token: [
Expected one of the following tokens instead: <identifier>,<eof>
22 | stationRole: String
23 | djs: [Dj] // Correct syntax for array of related entities
24 | }
- /home/jphj/rapid-fm/main.wasp @ 23:9-10
Parse error:
Unexpected token: Dj
Expected one of the following tokens instead: <eof>
22 | stationRole: String
23 | djs: [Dj] // Correct syntax for array of related entities
24 | }
ā --- [Error] Compilation of wasp project failed: --------------------------------
6 errors found
3 Replies
Hi @Mxrcy. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
The error messages indicate that there are syntax errors in your
main.wasp
file. The parser is having trouble understanding the password
, stationRole
, and djs
fields in your data model.
Unfortunately, the provided knowledge sources do not contain specific information about the correct syntax for defining data models in Wasp. Therefore, I would recommend checking the Wasp documentation (https://wasp-lang.dev/docs) for the correct syntax and examples of how to define data models.
If you continue to experience issues, consider opening an issue in the Wasp Github repository (https://github.com/wasp-lang/wasp/issues) or asking for help in the Wasp Discord community (https://discord.com/channels/686873244791210014/).
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Sorry @Mxrcy, 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?Here is my Main.Wasp
app rapidFm {
wasp: {
version: "^0.14.0"
},
title: "rapidFm",
client: {
rootComponent: import Layout from "@src/Layout.jsx",
},
auth: {
userEntity: User,
methods: {
usernameAndPassword: {}
},
onAuthFailedRedirectTo: "/login",
onAuthSucceededRedirectTo: "/"
},
}
entity User {
email: String
password: String
stationRole: String
djs: [Dj] // Correct syntax for array of related entities
}
entity Station {
name: String
url: String
shows: [Show]
djs: [Dj]
}
entity Show {
title: String
time: String
duration: Int
stationId: Int
station: Station @relation(fields: [stationId], references: [id]) // Correct relation syntax
}
entity Dj {
alias: String
userId: Int
user: User @relation(fields: [userId], references: [id]) // Correct relation syntax
stationId: Int
station: Station @relation(fields: [stationId], references: [id]) // Correct relation syntax
}
route LoginRoute { path: "/login", to: LoginPage }
page LoginPage {
component: import Login from "@src/pages/auth/Login.jsx"
}
route SignupRoute { path: "/signup", to: SignupPage }
page SignupPage {
component: import Signup from "@src/pages/auth/Signup.jsx"
}
action createStation {
fn: import { createStation } from "@src/actions.js",
entities: [Station]
}
action updateStation {
fn: import { updateStation } from "@src/actions.js",
entities: [Station]
}
action deleteStation {
fn: import { deleteStation } from "@src/actions.js",
entities: [Station]
}
action createShow {
fn: import { createShow } from "@src/actions.js",
entities: [Show, Station]
}
action updateShow {
fn: import { updateShow } from "@src/actions.js",
entities: [Show]
}
action handleWebSocketConnection {
fn: import { handleWebSocketConnection } from "@src/actions.js",
entities: []
}
query getStations {
fn: import { getStations } from "@src/queries.js",
entities: [Station]
}
query getShows {
fn: import { getShows } from "@src/queries.js",
entities: [Show, Station]
}
query getDjs {
fn: import { getDjs } from "@src/queries.js",
entities: [Dj, Station]
}
route HomeRoute { path: "/", to: HomePage }
page HomePage {
component: import HomePage from "@src/pages/Home.jsx",
authRequired: true
}
route StationRoute { path: "/station/:stationId", to: StationPage }
page StationPage {
component: import Station from "@src/pages/Station.jsx",
authRequired: true
}
route AdminRoute { path: "/admin", to: AdminPage }
page AdminPage {
component: import AdminPage from "@src/pages/Admin.jsx",
authRequired: true
}
app rapidFm {
wasp: {
version: "^0.14.0"
},
title: "rapidFm",
client: {
rootComponent: import Layout from "@src/Layout.jsx",
},
auth: {
userEntity: User,
methods: {
usernameAndPassword: {}
},
onAuthFailedRedirectTo: "/login",
onAuthSucceededRedirectTo: "/"
},
}
entity User {
email: String
password: String
stationRole: String
djs: [Dj] // Correct syntax for array of related entities
}
entity Station {
name: String
url: String
shows: [Show]
djs: [Dj]
}
entity Show {
title: String
time: String
duration: Int
stationId: Int
station: Station @relation(fields: [stationId], references: [id]) // Correct relation syntax
}
entity Dj {
alias: String
userId: Int
user: User @relation(fields: [userId], references: [id]) // Correct relation syntax
stationId: Int
station: Station @relation(fields: [stationId], references: [id]) // Correct relation syntax
}
route LoginRoute { path: "/login", to: LoginPage }
page LoginPage {
component: import Login from "@src/pages/auth/Login.jsx"
}
route SignupRoute { path: "/signup", to: SignupPage }
page SignupPage {
component: import Signup from "@src/pages/auth/Signup.jsx"
}
action createStation {
fn: import { createStation } from "@src/actions.js",
entities: [Station]
}
action updateStation {
fn: import { updateStation } from "@src/actions.js",
entities: [Station]
}
action deleteStation {
fn: import { deleteStation } from "@src/actions.js",
entities: [Station]
}
action createShow {
fn: import { createShow } from "@src/actions.js",
entities: [Show, Station]
}
action updateShow {
fn: import { updateShow } from "@src/actions.js",
entities: [Show]
}
action handleWebSocketConnection {
fn: import { handleWebSocketConnection } from "@src/actions.js",
entities: []
}
query getStations {
fn: import { getStations } from "@src/queries.js",
entities: [Station]
}
query getShows {
fn: import { getShows } from "@src/queries.js",
entities: [Show, Station]
}
query getDjs {
fn: import { getDjs } from "@src/queries.js",
entities: [Dj, Station]
}
route HomeRoute { path: "/", to: HomePage }
page HomePage {
component: import HomePage from "@src/pages/Home.jsx",
authRequired: true
}
route StationRoute { path: "/station/:stationId", to: StationPage }
page StationPage {
component: import Station from "@src/pages/Station.jsx",
authRequired: true
}
route AdminRoute { path: "/admin", to: AdminPage }
page AdminPage {
component: import AdminPage from "@src/pages/Admin.jsx",
authRequired: true
}
In Wasp 0.14.0, you can no longer use entities in the Wasp file, are you sure you have Wasp version 0.14.0 installed? Check with
wasp version