#eeynard_error

1 messages ยท Page 1 of 1 (latest)

civic furnaceBOT
#

๐Ÿ‘‹ 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/1270031217051435010

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

white radishBOT
#

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.

zealous wigeon
#

Sorry about the duplicate but I couldn't write back on the previous one. I did not knew about your real-time response rules. I'll try to catch the notification this time ๐Ÿ˜…

crude kelp
#

Hello

zealous wigeon
#

Hello

crude kelp
#

Do you have a serial number accessbile from one of the phones that you have been testing with?

zealous wigeon
#

Give me one sec

crude kelp
#

Hmm those are the actual device serial numbers, not the Stripe serial number for using the device as a reader, right?

zealous wigeon
#

oh yes sorry.

#

Is it possible to find those stripe ids on the dashboard ?

crude kelp
#

Otherwise if you can provide the Reader ID that would help too

#

Which looks like tmr_xxx and should be returned when you call discoverReaders()

zealous wigeon
#

d715ad003895a5e20669b98962178687bfb78d21b3fe2f93228797a2f8a63068

#

This is an ID from live mode

#

or the coresponding reader id => tmr_FqW3mQmr1BjV8W

#

So let me give you both :
tmr_FqW3mQmr1BjV8W / d715ad003895a5e20669b98962178687bfb78d21b3fe2f93228797a2f8a63068
tmr_FqdZeQ7LJN60FB / 11cdcd9ff2eb61ff921515887fcec643cb13295d6319d7c0974c334ef6eed467

crude kelp
#

Perfect, give me a few minutes to look at those and see if I can see anything

zealous wigeon
#

thank you !

crude kelp
#

When was the last time you ran into this issue with these readers?

#

Doesn't need to be exact, but would help me narrow down a time frame to look at our logs

zealous wigeon
#

hum

#

let me check

#

For the live ids that I gave you I would say on the 29 or 30 of july.

But if you want, I think i could give you a more precise date for the test I did this morning. Here is the new reader ids (in test mode this time, not live)
tmr_Fq2jtg3q96KHVD / 894f7c98fb9dd51ec9fe6f0545b474051d39743a385bda3e4ee47b162f3f602d

And it happened around 10:20 AM today UTCโˆ’4

#

one hour ago or something

crude kelp
#

Great that helps, looking

#

Also can you share your fetchTokenProvider() code?

zealous wigeon
#
const fetchTokenProvider = async () => {
  const { token } = await driverApi.get('/v1/tap-to-pay/stripe-token');

  console.log({ token });

  return token;
};

export const StripeProvider = ({ children }) => {
  return (
    <StripeTerminalProvider logLevel="verbose" tokenProvider={fetchTokenProvider}>
      <>{children}</>
    </StripeTerminalProvider>
  );
};
#

You mean you want to see what's inside the driverApi.get ? or thats ok ? It's basically a wrapper aroute axios

crude kelp
#

And what are you doing on your backend at that endpoint?

zealous wigeon
#

let me checek

crude kelp
#

Just calling our API for the token?

#

Or other stuff too?

#

Yeah that'd be great

#

Hmm I'm not seeing that error thrown for the test reader you provided above

zealous wigeon
#

It seems that we just ask stripe for a token with the /sessions endpoint

#

I juste figured that I have a precise hour in sentry
Occurred Aug 5, 2024 16:22:38 CEST

#

btw I don't remember if I gave you this piece of info but the error occured when I call discoverReaders with discoveryMethod: 'localMobile'

crude kelp
#

Yeah I figured this was for Tap to Pay based on your code above

#

The first logs I see for that reader around that time period start at 16:25 CEST when I see a reconnect occur

zealous wigeon
#

Without changing any code, and going through the same logic, if the user quit the app and come back it works. So I was wondering if there were something that need to be sync before I try to connect the the provider or something ๐Ÿคทโ€โ™‚๏ธ ?

crude kelp
#

You can reproduce this at will?

zealous wigeon
#

hum, so you did not received the /session call on your end attoun 16:22 CEST ?

zealous wigeon
crude kelp
#

Okay if you can reproduce then an exact list of the steps you take would be a helpful next step

#

Ah interesting okay I do see you creating Connection Tokens at 16:22:38

#

Oh wait no

#

16:21:38

#

Which makes sense

#

Why you see an error 60 seconds later

#

But I see 5 requests to your backend within a second there to do that

zealous wigeon
#

Step 1 => Connected account initialized acct_1PkSzr4JouukenHb

crude kelp
#

So 5 different Connection Tokens created

#

So I'm wondering if you have a re-render issue or something here that is causing duplicates which is leading to the issue

zealous wigeon
#

oh ! that's interesting, I'll check taht

#

I think axios is retrying 5 times by default also so that might be a clue

crude kelp
#

Ah interesting

zealous wigeon
#

I am cuyrrently reproducing the bug right now

crude kelp
#

Sounds good

zealous wigeon
#

ok I have the error

#

I don't have any reader ID since the call did not work

crude kelp
#

That's okay

zealous wigeon
#

but i have a connected account acct_1PkSzr4JouukenHb

crude kelp
#

Can you list out the exact steps you took to repro?

civic furnaceBOT
zealous wigeon
#
  1. Create a connect account (with pre-filled info from our DB)
  2. Finish filling the form
  3. Account is validated on stripe
  4. Render the success component that use the StripProvier component
    4.1. A call to /sessions is sent to stripe via our server
  5. Trying to connect to the reader with the following calls initialize, discoverReaders
  6. Loading for 60s and then the error shows
crude kelp
#

Are you using Destination Charges here?

#

Or trying to use these Readers directly on the Connected Account?

zealous wigeon
#

There is no delay between steps 4 and 5, could it be it ?

#

Maybe initialize, discoverReaders are called before the token is retrived from the StripProvider ?

zealous wigeon
crude kelp
#

Can you show me your connectLocalMobileReader code?

zealous wigeon
#
const fetchTokenProvider = async () => {
  const { token } = await driverApi.get('/v1/tap-to-pay/stripe-token');

  console.log({ token });

  return token;
};

export const StripeProvider = ({ children }) => {
  return (
    <StripeTerminalProvider logLevel="verbose" tokenProvider={fetchTokenProvider}>
      <>{children}</> // the children component is instantly calling initialize and then discoverReaders
    </StripeTerminalProvider>
  );
};
#

I checked with my backend colleague and my app called our API 3 times. Doesn't the StripeProvider handles re-render and call the tokenProvider callback only once ?

crude kelp
#

Not that I'm aware of, no... it does trigger whenever a reconnect happens though. But if you re-render your StripeProvider multiple times then my understanding is it will still fetch a new Token each time

#

Nothing is jumping out to me yet unfortunately

#

It basically seems like your discoverReaders() request is timing out

#

Hmm you haven't implemented the onUpdateDiscoveredReaders() callback?

#

Oh wait wait

zealous wigeon
#

Nop I use an effect on discoveredReaders from the SDK to watch for new readers

crude kelp
#

Your code is simply trying to set const selectedReader = discoveredReaders[0];

#

So like on the initial render discoveredReaders is null right?

zealous wigeon
#

Would be an empy array []

crude kelp
#

Right right

#

So yeah not sure how you would connect on this initial render here...

#

It would require a timeout and reconnection attempt

zealous wigeon
#

I don't, since selectedReader = undefined

crude kelp
#

At which point then discoveredReaders would no longer be empty

crude kelp
zealous wigeon
#

Ok I'll try to describe how it works

#

when my useStripSdk is called

  1. The sdk is not initialized so isInitialized === false so my first useEffect is called and terminal.initialize() is called
  2. After the init is done, isInitialized === true and so, the second useEffect triggers and call my function discover which calls terminal.discoverReaders({ discoveryMethod: 'localMobile' })
  3. The error occurs

The terminal.connectLocalobileReader is never called because it's the next step if discoverReaders is succesful and some readers are available.

#

The effect for connect is only called when !!selectedReader and const selectedReader = discoveredReaders[0]; so the effects wait for the reader to be discovered before being executed

crude kelp
#

Okay let's add:

useStripeTerminal({
      onUpdateDiscoveredReaders: (readers) => {
       console.log("ON UPDATE READERS FIRED: ", readers)
      },

And test again and let's see if that fires.

zealous wigeon
#

I'll try

#
 LOG  {"token":"pst_test_YWNjdF8xT2h2cUxLeXl6eFJvZlZZLDBva0RJenl4ZEJkOWUxQW9pTGRVSE5XaGhVbFRkb2Q_00Hiwsnuwm"}
 LOG  [Stripe terminal]: didChangeOfflineStatus {"reader": undefined, "sdk": {"networkStatus": "unknown", "offlinePaymentAmountsByCurrency": {}, "offlinePaymentsCount": 0}}
 LOG  [Stripe terminal]: didChangeOfflineStatus {"reader": undefined, "sdk": {"networkStatus": "online", "offlinePaymentAmountsByCurrency": {}, "offlinePaymentsCount": 0}}
 LOG  {"token":"pst_test_YWNjdF8xT2h2cUxLeXl6eFJvZlZZLGhFaktNYXVOUWd3WHh4VlBDRUQ5VmxaZEg0MmFQTHU_0035Gtm4Le"}
 LOG  [Stripe terminal]: didChangeOfflineStatus {"reader": undefined, "sdk": {"networkStatus": "online", "offlinePaymentAmountsByCurrency": {}, "offlinePaymentsCount": 0}}
 LOG  {"token":"pst_test_YWNjdF8xT2h2cUxLeXl6eFJvZlZZLGd0WWp0MXYyM1A4VkxmY01OM29IcEZnSmd0QVNOeWg_00fmUsBWIP"}
 LOG  [Stripe terminal]: didChangeOfflineStatus {"reader": undefined, "sdk": {"networkStatus": "online", "offlinePaymentAmountsByCurrency": {}, "offlinePaymentsCount": 0}}
 LOG  [Stripe terminal]: didFinishDiscoveringReaders {"error": {"code": "ConnectionTokenProviderTimedOut", "message": "Your app's ConnectionTokenProvider did not call the provided completion block within 60 seconds."}}

#

We see that again we have called 3 times the fetchToken

#

But we dont see the callback onUpdateDiscoveredReaders being called

crude kelp
#

You don't have timestamps per chance?

#

Curious if that error is 60 seconds after the initial fetchToken?

#

Maybe they will be too close together to tell though...

#

I do think the next step is to figure out why there are multiple fetchTokens occurring and then seeing if de-duplicating fixes the issue

zealous wigeon
#

It does not show the millis unfortunatly

crude kelp
#

Yeah you would have to add that to the logs if you wanted to check that

zealous wigeon
#

Ok so maybe I'll try to fix this first and see if that continues to happen

crude kelp
#

I think that's the next step

#

I'm still not positive why that error is being thrown

zealous wigeon
#

Take you very much for your time

crude kelp
#

But my guess right now is related to the re-fetches

#

Try to debug that and then if still happening let us know if we can help further

zealous wigeon
#

alright, I'll keep you updated about that. If I can still respond in the thread in a few hours / days :p

crude kelp
#

The thread will close after a period of inactivity but you can always re-open a new one!

zealous wigeon
#

Cool ! I appreciate your fast answers, it's really helpful, thank you again. Have a good one !