#eeynard_error
1 messages ยท Page 1 of 1 (latest)
๐ 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.
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.
- eeynard_error, 11 minutes ago, 4 messages
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 ๐
Hello
Hello
Do you have a serial number accessbile from one of the phones that you have been testing with?
Give me one sec
Hmm those are the actual device serial numbers, not the Stripe serial number for using the device as a reader, right?
Hmm can't remember since we focus on the API, check your Dashboard here: https://dashboard.stripe.com/test/terminal/readers
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
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()
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
Perfect, give me a few minutes to look at those and see if I can see anything
thank you !
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
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
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
And what are you doing on your backend at that endpoint?
let me checek
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
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'
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
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 ๐คทโโ๏ธ ?
You can reproduce this at will?
hum, so you did not received the /session call on your end attoun 16:22 CEST ?
I'll try rn (it may take a couple of minutes)
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
Step 1 => Connected account initialized acct_1PkSzr4JouukenHb
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
oh ! that's interesting, I'll check taht
I think axios is retrying 5 times by default also so that might be a clue
Ah interesting
I am cuyrrently reproducing the bug right now
Sounds good
That's okay
but i have a connected account acct_1PkSzr4JouukenHb
Can you list out the exact steps you took to repro?
- Create a connect account (with pre-filled info from our DB)
- Finish filling the form
- Account is validated on stripe
- Render the success component that use the StripProvier component
4.1. A call to /sessions is sent to stripe via our server - Trying to connect to the reader with the following calls
initialize,discoverReaders - Loading for 60s and then the error shows
Are you using Destination Charges here?
Or trying to use these Readers directly on the Connected Account?
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 ?
Yes we use the onBehalfOf feature and destination charges
Can you show me your connectLocalMobileReader code?
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 ?
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
Nop I use an effect on discoveredReaders from the SDK to watch for new readers
Your code is simply trying to set const selectedReader = discoveredReaders[0];
So like on the initial render discoveredReaders is null right?
Would be an empy array []
Right right
So yeah not sure how you would connect on this initial render here...
It would require a timeout and reconnection attempt
I don't, since selectedReader = undefined
At which point then discoveredReaders would no longer be empty
Not sure I understand?
Ok I'll try to describe how it works
when my useStripSdk is called
- The sdk is not initialized so
isInitialized === falseso my first useEffect is called andterminal.initialize()is called - After the init is done,
isInitialized === trueand so, the second useEffect triggers and call my functiondiscoverwhich callsterminal.discoverReaders({ discoveryMethod: 'localMobile' }) - 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
Okay let's add:
useStripeTerminal({
onUpdateDiscoveredReaders: (readers) => {
console.log("ON UPDATE READERS FIRED: ", readers)
},
And test again and let's see if that fires.
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
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
It does not show the millis unfortunatly
Yeah you would have to add that to the logs if you wanted to check that
Ok so maybe I'll try to fix this first and see if that continues to happen
Take you very much for your time
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
alright, I'll keep you updated about that. If I can still respond in the thread in a few hours / days :p
The thread will close after a period of inactivity but you can always re-open a new one!
Cool ! I appreciate your fast answers, it's really helpful, thank you again. Have a good one !