stripe / react-stripe-js

React components for Stripe.js and Stripe Elements
https://stripe.com/docs/stripe-js/react
MIT License
1.75k stars 267 forks source link

[BUG]: Uncaught SyntaxError: "[object Object]" is not valid JSON #497

Closed ventsislavnikolov closed 4 months ago

ventsislavnikolov commented 4 months ago

What happened?

The error is constantly spamming the console when using Elements when they are import from @stripe/react-stripe-js

Steps to reproduce:

  1. npx create-next-app --example with-stripe-typescript with-stripe-typescript-app
  2. make .env with keys
  3. run in dev
  4. go to Donate with Elements
  5. Open DevTools (F12)
  6. Observe the spam of the error

Or just go to the official demo -> https://nextjs-with-stripe-typescript-demo.vercel.app/donate-with-elements and open DevTools.

Environment

Chrome 124.0.6367.207 on Windows 11

Reproduction

https://nextjs-with-stripe-typescript-demo.vercel.app/donate-with-elements

brendanm-stripe commented 4 months ago

Hey there @ventsislavnikolov -- I am able to use the example you share and pay with *4242 successfully without seeing that error. Are there any particular steps you take on the page to produce it?

ventsislavnikolov commented 4 months ago

Hi @brendanm-stripe, my bad, very sorry about this. After your response I checked and found that is from one my Chrome extensions - Modheader. You can close the issue, but if you still want to check it:

  1. Install this extension - https://modheader.com/
  2. Go to the - https://nextjs-with-stripe-typescript-demo.vercel.app/donate-with-elements
  3. Open DevTools and select the Console.
  4. Wait for 2-3 seconds and the error start spamming.
brendanm-stripe commented 4 months ago

Gotcha - thanks for clarifying. Yes, it's possibly for some browser extensions to interfere with Stripe.js (particularly network tools like this or strict privacy tools that block scripts). This seems to be impacting analytics requests, and is not blocking the payment flow from succeeding.

If you encounter further issues while this is disabled please let us know!