Working on a migrating a kmp project to sqldelight...
# squarelibraries
p
Working on a migrating a kmp project to sqldelight 2.0. Currently working on the
JS
target. All good so far, I believe I have going through all the steps. However, after creating the database, the single first time I try to access it, get a crash:
Copy code
K {message: '{"message":"no such table: AccessTokenTb","name":"Error"}', cause: undefined, name: 'K', _suppressed: no, stack: 'K: {"message":"no such table: AccessTokenTb","name…<p://localhost:8080/amadeus-demo-app.js:2:2578780)>'}
cause
: 
undefined
message
: 
"{\"message\":\"no such table: AccessTokenTb\",\"name\":\"Error\"}"
name
: 
"K"
_suppressed
: 
no
h_1
: 
[X_]
i_1
: 
false
s3_1
: 
0
[[Prototype]]
: 
Lu
stack
: 
"K: {\"message\":\"no such table: AccessTokenTb\",\"name\":\"Error\"}\n    at h.xbd (<http://localhost:8080/amadeus-demo-app.js:2:2578643>)\n    at h.handleEvent (<http://localhost:8080/amadeus-demo-app.js:2:2578780>)"
[[Prototype]]
: 
Error
constructor
: 
ƒ K(t)
$metadata$
: 
{kind: 'class', simpleName: 'WebWorkerException', associatedObjectKey: undefined, associatedObjects: undefined, suspendArity: Array(0), …}
...
I see the sql code that generates the AccessTokenTb table is there. Also is working fine in the other platforms.
d
My first guess (because I often make this mistake myself and it should probably be enforced somehow) is that you're creating the schema without awaiting it
Schema.create().await()
or
Schema.awaitCreate()
will do the trick
👀 1
p
That was it right, sigh. Not sure for what reason I skipped that part of the documetation.
By the way working really good version 2.0