question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Improve Stack Traces for $transaction

See original GitHub issue

Bug description

When running this:

const transactionUpdate = prisma.transaction.create({
	data: {
		// ...
		amount: amount,
		user: {
			connect: {
				id: userId,
			},
		},
	},
})

const userUpdate = prisma.user.update({
	where: { id: userId },
	data: {
		balance: {
			increment: amount,
		},
	},
})

await prisma.$transaction([transactionUpdate, userUpdate])

when amount is unset, it results in the following error:

Error: Error in query graph construction: QueryParserError(QueryParserError { path: QueryPath { segments: ["Mutation", "createOneTransaction", "data", "TransactionCreateInput", "amount"] }, error_kind: RequiredValueNotSetError })
    at /Users/luca/projects/ws-backend/node_modules/@prisma/client/runtime/index.js:27330:19
    at processTicksAndRejections (node:internal/process/task_queues:93:5)

This is really frustrating since I have no idea where in my code this error occurred.

It works fine when I run it individually using await. This just happens when using with $transaction.

How to reproduce

Expected behavior

Prisma information

Environment & setup

  • OS:
  • Database:
  • Node.js version:
  • Prisma version: 2.13.0
@prisma/cli          : 2.13.0
@prisma/client       : 2.13.0
Current platform     : darwin
Query Engine         : query-engine 833ab05d2a20e822f6736a39a27de4fc8f6b3e49 (at node_modules/@prisma/engines/query-engine-darwin)
Migration Engine     : migration-engine-cli 833ab05d2a20e822f6736a39a27de4fc8f6b3e49 (at node_modules/@prisma/engines/migration-engine-darwin)
Introspection Engine : introspection-core 833ab05d2a20e822f6736a39a27de4fc8f6b3e49 (at node_modules/@prisma/engines/introspection-engine-darwin)
Format Binary        : prisma-fmt 833ab05d2a20e822f6736a39a27de4fc8f6b3e49 (at node_modules/@prisma/engines/prisma-fmt-darwin)
Studio               : 0.329.0
✨  Done in 2.60s.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:5
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
eduhenkecommented, Jan 12, 2022

We are needing this because we are integrating with an APM solution, and all queries we perform have a .$transaction wrapped in them(because we also need RLS-support)

2reactions
ghostcommented, Aug 11, 2021

Note that Prisma does have the stack trace of the call site. It could potentially add to the Error object. It does already add some information in dev mode: https://github.com/prisma/prisma/pull/8646.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Improving the stack trace or call stack visibility in New Relic
Hi Do we have any best practices or methods to improve the stack trace depth in Transaction traces . I am looking at...
Read more >
Debug error transactions with ease by inspecting their stack ...
With error transactions, inspecting each transaction's stack trace comes in handy. Stack traces are like reports-they list all method calls ...
Read more >
Better Solidity debugging: stack traces are finally here - Medium
There have been some attempts at stack traces or better error messages out there for a while, but they all have significant drawbacks...
Read more >
Understanding and Leveraging the Java Stack Trace - Stackify
Simply put, a stack trace is a representation of a call stack at a certain point in time, with each element representing a...
Read more >
Stack Tracing with Truffle Test
The stacktrace continues seamlessly from the Javascript test into the Solidity contracts. It begins in the Javscript where the transaction was sent, continues ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found