#FACELESSMAN
1 messages · Page 1 of 1 (latest)
Hi, are you seeing any errors? What changes did you recently make?
No errors on my side until this:
TypeError: Failed to fetch
at http.tsx:45:12
at Generator.next (<anonymous>)
at fulfilled (ext.js:55:26)
my CSP is defined here:
"content_security_policy": {
"connect-src": [
"https://sfdc-stripe.fly.dev/api/customer",
"https://sfdc-stripe.fly.dev/api/chatter",
"https://sfdc-stripe.fly.dev/api/logout"
],
so ideally it should be able to fetch?
that TypeError: comes from me doing this
} catch (e: any) {
console.log(e);
In a network call
where I try to do a POST request:
...
const res = await HTTPClient.callBackend("/api/customer", "POST",
...
I wonder if there is some kind of "permission" blocking me - it never happened before to me
Taking a look
What's triggering the fetch? Is it some kind of event? If so are they preventing the default behavior of that event so the fetch has a chance to finish?
No, nothing is preventing the default behaviour. The fetch happens when you open up the "Customer" view
You should prevent the navigation with event.prevetDefault()
I am expecting to this
setStatus(Status.NotSetup);
instead I get a network Error
but if I try to hit that API route manually
it should return something like {"type":"stripe","message":"Unable to extract timestamp and signatures from header"}
or anything.....but why would it instead "prevent fetch" from the browser side (the Stripe App)
almost like the Stripe App is blocking itself?
Hello! I'm taking over and catching up...
So usually TypeError: Failed to fetch is a result of the browser navigating before fetch can finish and return data, usually because fetch is being triggered by some kind of event that's causing navigation and you're not preventing that behavior. What is triggering fetch?
Is it like an event listener on a button press? A form submit? Something else?
I am trying to fetch the customer when in the Stripe App, I navigate to the customer view: https://github.com/sfdc-stripe/sfdc-stripe-frontend/blob/main/frontend/src/views/utils/http.tsx
so a navigation into the Customer page of the dashboard would trigger that fetch
What browser are you using?
Chrome and Firefox
on Ubuntu
I can try to explore more the code but its weird that suddenly it stopped working when this used to work a couple of weeks back - I was curious if anything changed that would prevent this in Stripe Apps
hence me asking
I can come back Monday and give it a different try over the weekend
all code is open source on that repo btw
You haven't modified the code at all?
well it uses my own .env of course ;P
Anyway I wasn't trying to write a whole chapter of a book, I was just curious if you knew of any changes to Stripe Apps - I tried to DM the other channel for Stripe apps but it's being retired