P
Prisma5mo ago
Oli

creating a record attempting to update it shortly after causes error

The code provided in the screenshot gives me this error
Invalid `prisma.hosting_ticket.update()` invocation in
D:\Coding\Birdflop\botflop-panel\src\functions\tickets\createTicket.ts:84:33
82
83 try {
→ 84 await prisma.hosting_ticket.update(
An operation failed because it depends on one or more records that were required but not found. Record to update not found.
at In.handleRequestError (D:\Coding\Birdflop\botflop-panel\node_modules\.pnpm\@[email protected][email protected]\node_modules\@prisma\client\runtime\library.js:122:6877)
at In.handleAndLogRequestError (D:\Coding\Birdflop\botflop-panel\node_modules\.pnpm\@[email protected][email protected]\node_modules\@prisma\client\runtime\library.js:122:6211)
at In.request (D:\Coding\Birdflop\botflop-panel\node_modules\.pnpm\@[email protected][email protected]\node_modules\@prisma\client\runtime\library.js:122:5919)
at async l (D:\Coding\Birdflop\botflop-panel\node_modules\.pnpm\@[email protected][email protected]\node_modules\@prisma\client\runtime\library.js:127:11167) at async createTicket (D:\Coding\Birdflop\botflop-panel\src\functions\tickets\createTicket.ts:84:5)
at async Object.execute (D:\Coding\Birdflop\botflop-panel\src\modals\ticket\create_hosting.ts:13:17)
Invalid `prisma.hosting_ticket.update()` invocation in
D:\Coding\Birdflop\botflop-panel\src\functions\tickets\createTicket.ts:84:33
82
83 try {
→ 84 await prisma.hosting_ticket.update(
An operation failed because it depends on one or more records that were required but not found. Record to update not found.
at In.handleRequestError (D:\Coding\Birdflop\botflop-panel\node_modules\.pnpm\@[email protected][email protected]\node_modules\@prisma\client\runtime\library.js:122:6877)
at In.handleAndLogRequestError (D:\Coding\Birdflop\botflop-panel\node_modules\.pnpm\@[email protected][email protected]\node_modules\@prisma\client\runtime\library.js:122:6211)
at In.request (D:\Coding\Birdflop\botflop-panel\node_modules\.pnpm\@[email protected][email protected]\node_modules\@prisma\client\runtime\library.js:122:5919)
at async l (D:\Coding\Birdflop\botflop-panel\node_modules\.pnpm\@[email protected][email protected]\node_modules\@prisma\client\runtime\library.js:127:11167) at async createTicket (D:\Coding\Birdflop\botflop-panel\src\functions\tickets\createTicket.ts:84:5)
at async Object.execute (D:\Coding\Birdflop\botflop-panel\src\modals\ticket\create_hosting.ts:13:17)
from my understand its unable to find the record which was just created.?
No description
5 Replies
Nurul
Nurul5mo ago
Hey, as the error message suggests the record that was supposed to be updated was not found. Can you confirm if the record from (hosting_ticket) that you wish to update exists in the database?
Oli
OliOP5mo ago
added something to first check if it exists and apparently it doesn’t, what i don’t understand is the newTicket variable doesn’t return an error or anything and when using newTicket.id it returns the properly autoincremented id
Nurul
Nurul5mo ago
Try logging the value of newTicket?
Oli
OliOP5mo ago
turns out it was me being dumb and another file was deleting it right after it was being created
Nurul
Nurul5mo ago
I am glad to hear that you figured out the cause of the issue 😄
Want results from more Discord servers?
Add your server