drizzle-kit generate not working with unhelpful error message

Ian into an issue with generate yesterday and can't really make sense of the error...

drizzle-kit: v0.22.7
drizzle-orm: v0.31.2

Reading config file '..../api/db/drizzle.config.ts'
....

....
rJ3fWPYaXdHqpHH2HP3X+c6ES9Jc8V/JjCws6mMBf99wfnyvluee3led/gulufeBH4sV58xilr/zSMhhf6M70BXIhd/YtcmI9vt1r7/8BPnl3FAA=) format("woff");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}
^

SyntaxError: Invalid or unexpected token
at internalCompileFunction (node:internal/vm:77:18)
at wrapSafe (node:internal/modules/cjs/loader:1288:20)
at Module._compile (node:internal/modules/cjs/loader:1340:27)
at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
at newLoader (..../node_modules/drizzle-kit/bin.cjs:17468:13)
at Object.newLoader (..../node_modules/drizzle-kit/bin.cjs:17468:13)
at extensions..js (..../node_modules/drizzle-kit/bin.cjs:19996:28)
at Module.load (node:internal/modules/cjs/loader:1207:32)
at Module._load (node:internal/modules/cjs/loader:1023:12)
at Module.require (node:internal/modules/cjs/loader:1235:19)

drizzle-kit: v0.22.7
drizzle-orm: v0.31.2

Reading config file '..../api/db/drizzle.config.ts'
....

....
rJ3fWPYaXdHqpHH2HP3X+c6ES9Jc8V/JjCws6mMBf99wfnyvluee3led/gulufeBH4sV58xilr/zSMhhf6M70BXIhd/YtcmI9vt1r7/8BPnl3FAA=) format("woff");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}
^

SyntaxError: Invalid or unexpected token
at internalCompileFunction (node:internal/vm:77:18)
at wrapSafe (node:internal/modules/cjs/loader:1288:20)
at Module._compile (node:internal/modules/cjs/loader:1340:27)
at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
at newLoader (..../node_modules/drizzle-kit/bin.cjs:17468:13)
at Object.newLoader (..../node_modules/drizzle-kit/bin.cjs:17468:13)
at extensions..js (..../node_modules/drizzle-kit/bin.cjs:19996:28)
at Module.load (node:internal/modules/cjs/loader:1207:32)
at Module._load (node:internal/modules/cjs/loader:1023:12)
at Module.require (node:internal/modules/cjs/loader:1235:19)
Downgrading drizzle-orm or drizzle-kit version does not change anything (min version tried: orm: 32.0 and kit:22.0 -> (did not go lower because since v32 the new drizzle kit version was required and a drizzle-kit up was done and the config changes were applied, etc...)) I dont know if any change in my schemas causes this issue but the schemas seem correct to me... Because i don't know what causes this looking at the error message i have a hard time debugging this... Did you run into the same issue or was yours of different nature?
1 Reply
eXecuteye
eXecuteye3mo ago
Update: after trying for way too long i found the issue... Having files in the schema folder that are not relevant to db tables (and therefore not exported in the schemas/index.ts file) caused this issue... In my case it was a utils file and ta types file inside the schema folder... After moving them outside of the schema folder, the issue did not occur again... I hope this helps if anyone else runs into this issue... It would be nice if the error message for this could be a bit more indicative to the issue causing it...
Want results from more Discord servers?
Add your server