GUD
GUD
TTCTheo's Typesafe Cult
Created by GUD on 7/23/2024 in #questions
Override error in React tutorial on the add userId to the database step
Coercing it with the following removes the problem and in theory should be fine because auth() is called in the middleware and the userId should only be empty if they fail auth correct?
userId: `${metadata.userId}`,
userId: `${metadata.userId}`,
8 replies
TTCTheo's Typesafe Cult
Created by GUD on 7/23/2024 in #questions
Override error in React tutorial on the add userId to the database step
This doesn't seem correct though as it may allow Drizzle to create a record without an actual userId attached which we would like rejected presumably.
8 replies
TTCTheo's Typesafe Cult
Created by GUD on 7/23/2024 in #questions
Override error in React tutorial on the add userId to the database step
It appears the error results from userId being declared as a not null varchar 256 while the clerk auth function returns a userId that can be either string or null. declaring the userId for the database insert like so fixes the problem but is clearly not the correct answer:
userId: metadata.userId ?? '',
userId: metadata.userId ?? '',
8 replies
TTCTheo's Typesafe Cult
Created by GUD on 7/23/2024 in #questions
Override error in React tutorial on the add userId to the database step
So I finished that segment of the tutorial and everything builds and works but VS Code is still identifying a problem with the values parameters
8 replies
TTCTheo's Typesafe Cult
Created by GUD on 7/23/2024 in #questions
Override error in React tutorial on the add userId to the database step
Along with this error:
The expected type comes from property 'userId' which is declared here on type '{ name: string | SQL<unknown> | Placeholder<string, any>; url: string | SQL<unknown> | Placeholder<string, any>; userId: string | SQL<unknown> | Placeholder<string, any>; id?: number | ... 2 more ... | undefined; createdAt?: SQL<...> | ... 2 more ... | undefined; updatedAt?: SQL<...> | ... 3 more ... | undefined; }'
The expected type comes from property 'userId' which is declared here on type '{ name: string | SQL<unknown> | Placeholder<string, any>; url: string | SQL<unknown> | Placeholder<string, any>; userId: string | SQL<unknown> | Placeholder<string, any>; id?: number | ... 2 more ... | undefined; createdAt?: SQL<...> | ... 2 more ... | undefined; updatedAt?: SQL<...> | ... 3 more ... | undefined; }'
Oddly enough everything seems to work fine locally. Building throws an error about missing configuration for DATABASE_URL which I suspect is related to further steps in this segment of the tutorial.
8 replies