Prisma breaks when on production server (dedicated server, backend app)

const fetched = await this.prisma.xpMultiplier.findFirst({
where: {
type,
selectorId
},
});
const fetched = await this.prisma.xpMultiplier.findFirst({
where: {
type,
selectorId
},
});
This compiles and runs just fine on my local machine, no errors whatsoever. So I push my schema, merge my deploy request on planet scale, pull the code, and start the app then I get this error:
discord:start: cache miss, executing f4b4a032f7fb9c18
discord:start:
discord:start: > discord@0.0.1 start /home/ubuntu/app/apps/discord
discord:start: > node dist/index.js
discord:start:
discord:start: ~discord-client ] Ready!
discord:start: Getting account for user 9ce86584-2888-4f5a-96e1-84a7c107762d
discord:start: node:events:491
discord:start: throw er; // Unhandled 'error' event
discord:start: ^
discord:start:
discord:start: TypeError: Cannot read properties of undefined (reading 'findFirst')
discord:start: at XPModifierManager.<anonymous> (/home/ubuntu/app/packages/database/dist/XPModifierManager.js:26:60)
discord:start: at Generator.next (<anonymous>)
discord:start: at /home/ubuntu/app/packages/database/dist/XPModifierManager.js:8:71
discord:start: at new Promise (<anonymous>)
discord:start: at __awaiter (/home/ubuntu/app/packages/database/dist/XPModifierManager.js:4:12)
discord:start: at XPModifierManager.get (/home/ubuntu/app/packages/database/dist/XPModifierManager.js:24:42)
discord:start: at Object.get (/home/ubuntu/app/packages/database/dist/XPModifierManager.js:79:37)
discord:start: at /home/ubuntu/app/apps/discord/dist/index.js:83:68
discord:start: at Generator.next (<anonymous>)
discord:start: at fulfilled (/home/ubuntu/app/apps/discord/dist/index.js:5:58)
discord:start: Emitted 'error' event on DiscordClient instance at:
discord:start: at emitUnhandledRejectionOrErr (node:events:394:10)
discord:start: at process.processTicksAndRejections (node:internal/process/task_queues:84:21)
discord:start:
discord:start: Node.js v18.15.0
discord:start:  ELIFECYCLE  Command failed with exit code 1.
discord:start: ERROR: command finished with error: command (/home/ubuntu/app/apps/discord) pnpm run start exited (1)
discord:start: cache miss, executing f4b4a032f7fb9c18
discord:start:
discord:start: > discord@0.0.1 start /home/ubuntu/app/apps/discord
discord:start: > node dist/index.js
discord:start:
discord:start: ~discord-client ] Ready!
discord:start: Getting account for user 9ce86584-2888-4f5a-96e1-84a7c107762d
discord:start: node:events:491
discord:start: throw er; // Unhandled 'error' event
discord:start: ^
discord:start:
discord:start: TypeError: Cannot read properties of undefined (reading 'findFirst')
discord:start: at XPModifierManager.<anonymous> (/home/ubuntu/app/packages/database/dist/XPModifierManager.js:26:60)
discord:start: at Generator.next (<anonymous>)
discord:start: at /home/ubuntu/app/packages/database/dist/XPModifierManager.js:8:71
discord:start: at new Promise (<anonymous>)
discord:start: at __awaiter (/home/ubuntu/app/packages/database/dist/XPModifierManager.js:4:12)
discord:start: at XPModifierManager.get (/home/ubuntu/app/packages/database/dist/XPModifierManager.js:24:42)
discord:start: at Object.get (/home/ubuntu/app/packages/database/dist/XPModifierManager.js:79:37)
discord:start: at /home/ubuntu/app/apps/discord/dist/index.js:83:68
discord:start: at Generator.next (<anonymous>)
discord:start: at fulfilled (/home/ubuntu/app/apps/discord/dist/index.js:5:58)
discord:start: Emitted 'error' event on DiscordClient instance at:
discord:start: at emitUnhandledRejectionOrErr (node:events:394:10)
discord:start: at process.processTicksAndRejections (node:internal/process/task_queues:84:21)
discord:start:
discord:start: Node.js v18.15.0
discord:start:  ELIFECYCLE  Command failed with exit code 1.
discord:start: ERROR: command finished with error: command (/home/ubuntu/app/apps/discord) pnpm run start exited (1)
18 Replies
Rhys
Rhys2y ago
Did you generate your database package? Looks like that might be causing this Personally I run yarn db:generate as a post install script
Hycord | @ When Replying
I generated it multiple times
Rhys
Rhys2y ago
generated it on the server side that you're running on right? what are you hosting this discord bot on?
Hycord | @ When Replying
A shitty ubuntu server from oracle so I have my dist in git I build on my machine, push the built code and run that That's worked up to this point but now Im having that issue The VM isn't strong enough to handle building the whole project lmfao
Rhys
Rhys2y ago
im pretty sure you'd be able to host it for free on railway, that'd be at least a bit better aside from that, im 90% sure your error is being caused from not generating your prisma typings, try doing it on the server and see if it fixes it whenever ive encountered that before its been from not generating prisma
Hycord | @ When Replying
I just finally got a server with 20gb ram and 3cpu cores and its on intel instead of 1cpu with 1gb ram on AMD lmao so now I can build on the server and not just on my client
Rhys
Rhys2y ago
i do not understand the status of this question
Hycord | @ When Replying
../../node_modules/.pnpm/@discordjs+rest@1.6.0/node_modules/@discordjs/rest/dist/index.d.ts(683,5): error TS18028: Private identifiers are only available when targeting ECMAScript 2015 and higher.
database:build: ../../node_modules/.pnpm/@sapphire+snowflake@3.4.0/node_modules/@sapphire/snowflake/dist/index.d.ts(15,5): error TS18028: Private identifiers are only available when targeting ECMAScript 2015 and higher.
database:build: tsconfig.json(2,16): error TS6053: File 'tsconfig/library.json' not found.
database:build:  ELIFECYCLE  Command failed with exit code 2.
database:build: ERROR: command finished with error: command (/home/ubuntu/app/packages/database) pnpm run build exited (1)
../../node_modules/.pnpm/@discordjs+rest@1.6.0/node_modules/@discordjs/rest/dist/index.d.ts(683,5): error TS18028: Private identifiers are only available when targeting ECMAScript 2015 and higher.
database:build: ../../node_modules/.pnpm/@sapphire+snowflake@3.4.0/node_modules/@sapphire/snowflake/dist/index.d.ts(15,5): error TS18028: Private identifiers are only available when targeting ECMAScript 2015 and higher.
database:build: tsconfig.json(2,16): error TS6053: File 'tsconfig/library.json' not found.
database:build:  ELIFECYCLE  Command failed with exit code 2.
database:build: ERROR: command finished with error: command (/home/ubuntu/app/packages/database) pnpm run build exited (1)
THat's what I'm getting when building on my serevr builds without any errors on my local machine
Rhys
Rhys2y ago
what node version is your server & local machine running
Rhys
Rhys2y ago
you may want to get those in sync although it might not make a difference, especially for pnpm since that is where the error looks like its being caused from is your code open source? also is your local machine windows and server linux? looking at the error "tsconfig/library.json" maybe it has to do with relative paths i.e doing ./tsconfig/library.json instead also check typescript versions
Hycord | @ When Replying
Local machine is windows server is linux I need to switch back to linux as a desktop I regret coming back to windows My mentor misled me dearly I've never had issues with this in the liek 2 months I've been working on this Ended up restarting my machine and now it seems to be throwing another error
../../node_modules/.pnpm/@discordjs+rest@1.6.0/node_modules/@discordjs/rest/dist/index.d.ts(683,5): error TS18028: Private identifiers are only available when targeting ECMAScript 2015 and higher.
database:build: ../../node_modules/.pnpm/@sapphire+snowflake@3.4.0/node_modules/@sapphire/snowflake/dist/index.d.ts(15,5): error TS18028: Private identifiers are only available when targeting ECMAScript 2015 and higher.
database:build: tsconfig.json(2,16): error TS6053: File 'tsconfig/library.json' not found.
../../node_modules/.pnpm/@discordjs+rest@1.6.0/node_modules/@discordjs/rest/dist/index.d.ts(683,5): error TS18028: Private identifiers are only available when targeting ECMAScript 2015 and higher.
database:build: ../../node_modules/.pnpm/@sapphire+snowflake@3.4.0/node_modules/@sapphire/snowflake/dist/index.d.ts(15,5): error TS18028: Private identifiers are only available when targeting ECMAScript 2015 and higher.
database:build: tsconfig.json(2,16): error TS6053: File 'tsconfig/library.json' not found.
this is pissing me off
Rhys
Rhys2y ago
Did you update pnpm, ts, etc?
Hycord | @ When Replying
I got it working
Rhys
Rhys2y ago
What fixed it?
Want results from more Discord servers?
Add your server