#martin-gaibisso_error

1 messages ยท Page 1 of 1 (latest)

bold treeBOT
#

๐Ÿ‘‹ Welcome to your new thread!

โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

๐Ÿ”— This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1339290974253355059

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.

rapid whale
#

Hi ๐Ÿ‘‹

Can you provide more details about what is happening in prototype.js on and before line 828?

#

What are you trying to do on the line where the error is thrown?

smoky mist
#

i'm not trying to do anything, this is your library failing to initialize

#

here you can see the error message in the console with the full stack

rapid whale
#

Can you share what you are doing in prototype.js on line 838?

smoky mist
#

thats javascript's prototype.js

rapid whale
#

How/where are you instantiating Stripe.js?

smoky mist
#

just loading the file and this happens

#

i get Uncaught ReferenceError: Stripe is not defined if i try to use it

rapid whale
#

The request to https://js.stripe.com/v3/ is returned with a 200 status and the Stripe.js code.

#

How are you loading it on your site?

smoky mist
rapid whale
#

And you get an error when you attempt to run

var stripe = Stripe('pk_XXXXX');
smoky mist
#

correct

#

no

#

the original error is when loading the lib

#

if i try to initialize i get Uncaught ReferenceError: Stripe is not defined

rapid whale
#

The resource is being returned correctly. You can see that in the Networks tab.

#

Are you using some web framework that might be attempting to use Stripe.js before the DOM has loaded?

smoky mist
#

idk

#

why would it fail afterwards?

rapid whale
#

What do you mean?

smoky mist
#

why no Stripe const?

#

thats suppose to be standalone

rapid whale
#

I am saying I suspect that you are attempting to load/use Stripe.js before Stripe.js has been loaded by your site

#

If you are using a framework that performs some operations server-side, before the client loads, that might cause an error like this

smoky mist
#

i dont understand why anything server side would affect a js library being loaded in the browser

rapid whale
#

I don't think it is. The JS library is loading fine.

#

That is not what I'm saying

smoky mist
#

but why no Stripe available?

rapid whale
#

I am saying, I think your site is attempting to use it before it's loaded in the browser

#

Basically, I know loading Stripe.jS from the <script src="https://js.stripe.com/v3/"></script> tag works just fine. I've loaded over 20 sites that use it while we've had this chat.

#

What I am attempting to determine, based mostly on guesses, is what might result in you attempting to use it without having it correctly loaded in your JS runtime environment.

#

So far, you have not provided much information about how your site is built and what frameworks you are using

#

That would be helpful

smoky mist
#

i know it works, i also have deployed a lot of sites. we make a plugin for magento that integrates stripe connect. there is a problem with this particular one

#

what i dont understand is why would the init of the Stripe lib fails

#

since that i presume is a standalone lib

#

the file loads

#

but the init fails with that error

#

even if i try using the lib when still not ready, it should work afterwards

#

the lib loads but yet: Uncaught ReferenceError: Stripe is not defined

rapid whale
#

Where are you attempting to perform the initialization?

smoky mist
rapid whale
#

Hmm...definitely not loaded. Neither Stripe nor window.Stripe

#

And, if you look at the v3/ network response payload, you can see its an IIFE that returns the Stripe lib

smoky mist
#

yeah, idk why it doesn't initialize

#

only happening on this site but i have no idea why

rapid whale
#

Yeah that's why I'm wondering what about this site might be causing the issues. Something in the architecture.