-
Notifications
You must be signed in to change notification settings - Fork 764
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uncaught error: Cannot assign to read only property 'stack' of object 'Error' #414
Comments
@DamodarSojka How are you assigning |
I have tried both this.Stripe = new Stripe(API_KEY) ; (with @types/stripe) |
I cannot seem to reproduce this on my end. Do you think you can provide a minimal example to reproduce the issue? You can use |
Do you think you can provide a minimal example to reproduce the issue? - I would love to! Not sure how to approach that however... Same issue when using source: "tok_chargeCustomerFail". Btw, I didn't know I can simulate invalid token like that, is there a list of those somewhere? |
If you can reliably reproduce the issue, try stripping the code until you get to the bare minimum needed to showcase the issue, and share the code here (you can use https://gist.github.com or https://pastebin.com if the code is too long).
Yes, in the testing doc page, you can click the "Tokens" tab to show static test tokens. |
It seems that this code makes the stripe code to fail: Object.defineProperty(Error.prototype, "stack", {
configurable: true,
enumerable: true,
}); It is meant to help with logging in hapi. Read more here: hapijs/hapi#2744 |
Thanks! I was able to reproduce the issue with this code: Object.defineProperty(Error.prototype, "stack", {
configurable: true,
enumerable: true,
});
this.Stripe = require("stripe")(process.env.STRIPE_SECRET_KEY);
this.Stripe.charges.create({
amount: 400,
currency: 'usd',
source: 'tok_chargeCustomerFail',
}); When you call Object.defineProperty(Error.prototype, "stack", {
configurable: true,
enumerable: true,
writable: true,
});
... Can you give it a try and let me know if that solves the problem for you? |
Adding writable: true solves the problem. Thank you very much! |
When calling:
with 4000000000000341 (Attaching this card to a Customer object succeeds, but attempts to charge the customer fail.) I receive the following error:
When the code is run with a "normal card" (for example: 4242424242424242) everything works fine.
Stack trace:
"stripe": "^5.3.0"
alpine-node:8.1.0
The text was updated successfully, but these errors were encountered: