razorpay / razorpay/razorpay-node
Promise rejection without error in `instance.orders.create()`
Open
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 243
- Forks
- 128
- PR merge metrics
- No merged PRs in 30d
Description
Steps to reproduce the behavior
try {
const response = await razorpay.orders.create({
amount: amount * 100,
currency: "INR",
});
return {
amount: response.amount,
currency: response.currency,
orderId: response.id,
};
} catch (e) {
console.log(e);
throw new TRPCError({
code: "INTERNAL_SERVER_ERROR",
});
}
`(node:15211) Warning: a promise was rejected with a non-error: [object Object]`
Logging the error returns `{ statusCode: undefined, error: undefined }`.
Expected behavior
Should return the error if there is any.
Actual behavior
Sometimes the promise resolves itself without any error and sometimes it doesn't.
Code snippets
No response
Node version
v20.8.0
Library version
razorpay 2.9.2
Additional Information
No response
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the instance.orders.create() entry point and reproduce the behavior with Node v20.8.0 and razorpay 2.9.2, checking both resolved and rejected calls. Done means failures consistently reject with an error containing the available statusCode and error details instead of a non-error object or an apparent success.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 42/100