TypedSQL failing during build step

Hey there, I am having an issue where my SQL scripts run perfectly fine during developing but during my build step I am receiving the following error. I am unsure how to begin to debug this issue, so any suggestions are appreciated.
Failed to compile.

./node_modules/.prisma/client/sql/getPostReactionsNoUser.d.ts:6:39
Type error: Type expected.

4 | * @param Post ID
5 | */
> 6 | export const getPostReactionsNoUser: (: string) => $runtime.TypedSql<getPostReactionsNoUser.Parameters, getPostReactionsNoUser.Result>
| ^
7 |
8 | export namespace getPostReactionsNoUser {
9 | export type Parameters = [string]
Failed to compile.

./node_modules/.prisma/client/sql/getPostReactionsNoUser.d.ts:6:39
Type error: Type expected.

4 | * @param Post ID
5 | */
> 6 | export const getPostReactionsNoUser: (: string) => $runtime.TypedSql<getPostReactionsNoUser.Parameters, getPostReactionsNoUser.Result>
| ^
7 |
8 | export namespace getPostReactionsNoUser {
9 | export type Parameters = [string]
Here is the script in question: getPostReactionsNoUser.sql
-- @param {String} $1: Post ID
SELECT
p."id" AS "postId",
reaction_types."id" AS "reactionTypeId",
CAST(COUNT(reactions."id") AS INTEGER) AS "reactionCount",
reaction_types."emoji" AS "emoji",
reaction_types."name" AS "emojiName",
FALSE AS "reacted"
FROM posts p
LEFT JOIN reactions ON p."id" = reactions."post_id"
LEFT JOIN reaction_types ON reaction_types."id" = reactions."reaction_type_id"
WHERE p."id" = $1::uuid
GROUP BY p."id", reaction_types."id", reaction_types."name", reaction_types."emoji"
ORDER BY p."id", reaction_types."id";
-- @param {String} $1: Post ID
SELECT
p."id" AS "postId",
reaction_types."id" AS "reactionTypeId",
CAST(COUNT(reactions."id") AS INTEGER) AS "reactionCount",
reaction_types."emoji" AS "emoji",
reaction_types."name" AS "emojiName",
FALSE AS "reacted"
FROM posts p
LEFT JOIN reactions ON p."id" = reactions."post_id"
LEFT JOIN reaction_types ON reaction_types."id" = reactions."reaction_type_id"
WHERE p."id" = $1::uuid
GROUP BY p."id", reaction_types."id", reaction_types."name", reaction_types."emoji"
ORDER BY p."id", reaction_types."id";
And finally, because I suspect this could be related, I will include my build script:
"scripts": {
"dev": "next dev --turbopack -H 0.0.0.0",
"build": "npx prisma db push && npx prisma generate --sql && npx prisma db seed && next build",
"start": "next start",
"lint": "next lint"
},
"scripts": {
"dev": "next dev --turbopack -H 0.0.0.0",
"build": "npx prisma db push && npx prisma generate --sql && npx prisma db seed && next build",
"start": "next start",
"lint": "next lint"
},
2 Replies
RaphaelEtim
RaphaelEtim2w ago
Hey @Alaskan donut Can you enable debugging to get more detailed error information?
export DEBUG="prisma:*"
export DEBUG="prisma:*"
Also which Typescript version are you using?
Alaskan donut
Alaskan donutOP2w ago
TypeScript is "^5", prisma and prisma client are both "^6.0.1" The console appears to give no insight into this specific issue post-linting:
2024-12-09T19:55:10.610Z eslint:lint-result-cache Persisting cached results: C:\Users\jason\dev\masque\.next\cache\eslint\.cache_12rpit9
2024-12-09T19:55:10.620Z eslint:cli-engine Linting complete in: 82ms
Failed to compile.

./node_modules/.prisma/client/sql/getPostReactionsNoUser.d.ts:6:39
Type error: Type expected.

4 | * @param Post ID
5 | */
> 6 | export const getPostReactionsNoUser: (: string) => $runtime.TypedSql<getPostReactionsNoUser.Parameters, getPostReactionsNoUser.Result>
| ^
7 |
8 | export namespace getPostReactionsNoUser {
9 | export type Parameters = [string]
2024-12-09T19:55:10.610Z eslint:lint-result-cache Persisting cached results: C:\Users\jason\dev\masque\.next\cache\eslint\.cache_12rpit9
2024-12-09T19:55:10.620Z eslint:cli-engine Linting complete in: 82ms
Failed to compile.

./node_modules/.prisma/client/sql/getPostReactionsNoUser.d.ts:6:39
Type error: Type expected.

4 | * @param Post ID
5 | */
> 6 | export const getPostReactionsNoUser: (: string) => $runtime.TypedSql<getPostReactionsNoUser.Parameters, getPostReactionsNoUser.Result>
| ^
7 |
8 | export namespace getPostReactionsNoUser {
9 | export type Parameters = [string]
Want results from more Discord servers?
Add your server