supabase: Failed Fetch API in Safari due to access control checks
Discussed in https://github.com/orgs/supabase/discussions/19983
<div type='discussions-op-text'>Originally posted by asyncink December 23, 2023 Hello!
We are facing errors in Safari which are not reproduced in 100% cases, but are definitely on Supabase side and are reproduced consistently in Safari browser. Safari makes preflight request (OPTIONS) when interacting with Supabase API. And for some reason, that we can not clearly figure out on our side, these requests are failed with following errors to the browser console. Fetch fails when fetching rows from database or during authentication (actually any Supabase APIs are affected).
Fetch API cannot load https://jhfjkcfjxvjlvipwubnk.supabase.co/rest/v1/orders?select=*&order=creationDate.desc due to access control checks.
Fetch API cannot load https://jhfjkcfjxvjlvipwubnk.supabase.co/auth/v1/token?grant_type=password due to access control checks.
And even logout fails:
Fetch API cannot load https://jhfjkcfjxvjlvipwubnk.supabase.co/auth/v1/logout?scope=global due to access control checks.
We can see these request in Supabase logs and they have status 200 OK, but we suppose that reason is in inappropriate response headers.
OPTIONS \| 200 \| 62.217.185.59 \| 839c5ef3cf951640 \| https://jhfjkcfjxvjlvipwubnk.supabase.co/rest/v1/orders?select=*&order=creationDate.desc \| Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.2 Safari/605.1.15,"[{"cf":[{"asOrganization":"Lovitel","asn":41275,"botManagement":[{"corporateProxy":false,"detectionIds":[],"ja3Hash":null,"jsDetection":[{"passed":false}],"score":99,"staticResource":false,"verifiedBot":false}],"city":"Moscow","clientAcceptEncoding":"gzip, deflate, br","clientTcpRtt":null,"clientTrustScore":null,"colo":"DME","continent":"EU","country":"RU","edgeRequestKeepAliveStatus":1,"httpProtocol":"HTTP/3","isEUCountry":null,"latitude":"55.74830","longitude":"37.61710","metroCode":null,"postalCode":"129346","region":"Moscow","regionCode":"MOW","requestPriority":null,"timezone":"Europe/Moscow","tlsCipher":"AEAD-AES128-GCM-SHA256","tlsClientAuth":[{"certPresented":"0","certRevoked":"0","certVerified":"NONE"}],"tlsExportedAuthenticator":[{"clientFinished":"57b39461713218a8475fd40af03433d80f9f934493498669e6ff453642b7ad3b","clientHandshake":"96fc1b0789091ce7de96a39684164c18f0ffaa23c546fd7a5b77907f98cc8ea6","serverFinished":"c63adc37346ea19fb314f7847402fbc05631155c62dcdbd9723c2381ff18ea87","serverHandshake":"275a9a984f3f43d11af3cfec8e747bdd27abe7ac1c4e2d77eb3eae007ade4c7e"}],"tlsVersion":"TLSv1.3","verifiedBotCategory":null}],"headers":[{"accept":"*/*","cf_cache_status":null,"cf_connecting_ip":"62.217.185.59","cf_ipcountry":"RU","cf_ray":"839c5ef3cf951640","content_length":"0","content_location":null,"content_range":null,"content_type":null,"date":null,"host":"jhfjkcfjxvjlvipwubnk.supabase.co","prefer":null,"range":null,"referer":"https://bounceflowers-cuxen9aun-asyncink.vercel.app/","sb_gateway_mode":null,"sb_gateway_version":null,"user_agent":"Mozilla/5.0 (Macintosh | Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.2 Safari/605.1.15","x_client_info":null,"x_forwarded_proto":"https","x_forwarded_user_agent":null,"x_kong_proxy_latency":null,"x_kong_upstream_latency":null,"x_real_ip":"62.217.185.59"}],"host":"jhfjkcfjxvjlvipwubnk.supabase.co","method":"OPTIONS","path":"/rest/v1/orders","port":null,"protocol":"https:","sb":[],"search":"?select=*&order=creationDate.desc","url":"https://jhfjkcfjxvjlvipwubnk.supabase.co/rest/v1/orders?select=*&order=creationDate.desc"}]","2023-12-23T00:08:35.183000"
OPTIONS \| 200 \| 62.217.185.59 \| 839c5e921bb17b5f \| https://jhfjkcfjxvjlvipwubnk.supabase.co/rest/v1/orders?select=*&order=creationDate.desc \| Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.2 Safari/605.1.15,"[{"cf":[{"asOrganization":"Lovitel","asn":41275,"botManagement":[{"corporateProxy":false,"detectionIds":[],"ja3Hash":null,"jsDetection":[{"passed":false}],"score":99,"staticResource":false,"verifiedBot":false}],"city":"Moscow","clientAcceptEncoding":"gzip, deflate, br","clientTcpRtt":null,"clientTrustScore":null,"colo":"DME","continent":"EU","country":"RU","edgeRequestKeepAliveStatus":1,"httpProtocol":"HTTP/3","isEUCountry":null,"latitude":"55.74830","longitude":"37.61710","metroCode":null,"postalCode":"129346","region":"Moscow","regionCode":"MOW","requestPriority":null,"timezone":"Europe/Moscow","tlsCipher":"AEAD-AES128-GCM-SHA256","tlsClientAuth":[{"certPresented":"0","certRevoked":"0","certVerified":"NONE"}],"tlsExportedAuthenticator":[{"clientFinished":"30063dc25172a3cfcc57713615f8b2ae62eeb0ec158d98bfcbbfe7d93c81c9e7","clientHandshake":"f363307c86c58c329a7a84dedc2230960e149f9b67c0b88577e551887845c9d6","serverFinished":"6ed18d4e5da30019ada2cfb7e94f0c37dad4be228e2411049853f6f8adafeac5","serverHandshake":"bc9c0b0a6dbaa52f3bea51b9d3a4ac0d9ed27e8739050d5da2e7e0411d01f627"}],"tlsVersion":"TLSv1.3","verifiedBotCategory":null}],"headers":[{"accept":"*/*","cf_cache_status":null,"cf_connecting_ip":"62.217.185.59","cf_ipcountry":"RU","cf_ray":"839c5e921bb17b5f","content_length":"0","content_location":null,"content_range":null,"content_type":null,"date":null,"host":"jhfjkcfjxvjlvipwubnk.supabase.co","prefer":null,"range":null,"referer":"https://bounceflowers-cuxen9aun-asyncink.vercel.app/","sb_gateway_mode":null,"sb_gateway_version":null,"user_agent":"Mozilla/5.0 (Macintosh | Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.2 Safari/605.1.15","x_client_info":null,"x_forwarded_proto":"https","x_forwarded_user_agent":null,"x_kong_proxy_latency":null,"x_kong_upstream_latency":null,"x_real_ip":"62.217.185.59"}],"host":"jhfjkcfjxvjlvipwubnk.supabase.co","method":"OPTIONS","path":"/rest/v1/orders","port":null,"protocol":"https:","sb":[],"search":"?select=*&order=creationDate.desc","url":"https://jhfjkcfjxvjlvipwubnk.supabase.co/rest/v1/orders?select=*&order=creationDate.desc"}]","2023-12-23T00:08:19.560000"
OPTIONS \| 200 \| 62.217.185.59 \| 839c5e921bb37b5f \| https://jhfjkcfjxvjlvipwubnk.supabase.co/rest/v1/orders?select=*&order=creationDate.desc \| Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.2 Safari/605.1.15,"[{"cf":[{"asOrganization":"Lovitel","asn":41275,"botManagement":[{"corporateProxy":false,"detectionIds":[],"ja3Hash":null,"jsDetection":[{"passed":false}],"score":99,"staticResource":false,"verifiedBot":false}],"city":"Moscow","clientAcceptEncoding":"gzip, deflate, br","clientTcpRtt":null,"clientTrustScore":null,"colo":"DME","continent":"EU","country":"RU","edgeRequestKeepAliveStatus":1,"httpProtocol":"HTTP/3","isEUCountry":null,"latitude":"55.74830","longitude":"37.61710","metroCode":null,"postalCode":"129346","region":"Moscow","regionCode":"MOW","requestPriority":null,"timezone":"Europe/Moscow","tlsCipher":"AEAD-AES128-GCM-SHA256","tlsClientAuth":[{"certPresented":"0","certRevoked":"0","certVerified":"NONE"}],"tlsExportedAuthenticator":[{"clientFinished":"30063dc25172a3cfcc57713615f8b2ae62eeb0ec158d98bfcbbfe7d93c81c9e7","clientHandshake":"f363307c86c58c329a7a84dedc2230960e149f9b67c0b88577e551887845c9d6","serverFinished":"6ed18d4e5da30019ada2cfb7e94f0c37dad4be228e2411049853f6f8adafeac5","serverHandshake":"bc9c0b0a6dbaa52f3bea51b9d3a4ac0d9ed27e8739050d5da2e7e0411d01f627"}],"tlsVersion":"TLSv1.3","verifiedBotCategory":null}],"headers":[{"accept":"*/*","cf_cache_status":null,"cf_connecting_ip":"62.217.185.59","cf_ipcountry":"RU","cf_ray":"839c5e921bb37b5f","content_length":"0","content_location":null,"content_range":null,"content_type":null,"date":null,"host":"jhfjkcfjxvjlvipwubnk.supabase.co","prefer":null,"range":null,"referer":"https://bounceflowers-cuxen9aun-asyncink.vercel.app/","sb_gateway_mode":null,"sb_gateway_version":null,"user_agent":"Mozilla/5.0 (Macintosh | Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.2 Safari/605.1.15","x_client_info":null,"x_forwarded_proto":"https","x_forwarded_user_agent":null,"x_kong_proxy_latency":null,"x_kong_upstream_latency":null,"x_real_ip":"62.217.185.59"}],"host":"jhfjkcfjxvjlvipwubnk.supabase.co","method":"OPTIONS","path":"/rest/v1/orders","port":null,"protocol":"https:","sb":[],"search":"?select=*&order=creationDate.desc","url":"https://jhfjkcfjxvjlvipwubnk.supabase.co/rest/v1/orders?select=*&order=creationDate.desc"}]","2023-12-23T00:08:19.560000"
OPTIONS \| 200 \| 62.217.185.59 \| 839c5dc98a245ab2 \| https://jhfjkcfjxvjlvipwubnk.supabase.co/rest/v1/orders?select=*&order=creationDate.desc \| Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.2 Safari/605.1.15,"[{"cf":[{"asOrganization":"Lovitel","asn":41275,"botManagement":[{"corporateProxy":false,"detectionIds":[],"ja3Hash":null,"jsDetection":[{"passed":false}],"score":99,"staticResource":false,"verifiedBot":false}],"city":"Moscow","clientAcceptEncoding":"gzip, deflate, br","clientTcpRtt":null,"clientTrustScore":null,"colo":"DME","continent":"EU","country":"RU","edgeRequestKeepAliveStatus":1,"httpProtocol":"HTTP/3","isEUCountry":null,"latitude":"55.74830","longitude":"37.61710","metroCode":null,"postalCode":"129346","region":"Moscow","regionCode":"MOW","requestPriority":null,"timezone":"Europe/Moscow","tlsCipher":"AEAD-AES128-GCM-SHA256","tlsClientAuth":[{"certPresented":"0","certRevoked":"0","certVerified":"NONE"}],"tlsExportedAuthenticator":[{"clientFinished":"82785ae52b902aa47525be8e9774bc4416de1e716d566727f7236cac26e8df53","clientHandshake":"266d2096b319f848739ed36c81e7a59ced50ac4f69ef8fb29dca8f0eb38f92a3","serverFinished":"a0b980d770743026428dbdbbd9fe3377ae3c49fb49ae9245424fe7fc5dad552b","serverHandshake":"a59f566cf408652810ceded07092b7da69e6296b3a1f73ee70d060e425af25e7"}],"tlsVersion":"TLSv1.3","verifiedBotCategory":null}],"headers":[{"accept":"*/*","cf_cache_status":null,"cf_connecting_ip":"62.217.185.59","cf_ipcountry":"RU","cf_ray":"839c5dc98a245ab2","content_length":"0","content_location":null,"content_range":null,"content_type":null,"date":null,"host":"jhfjkcfjxvjlvipwubnk.supabase.co","prefer":null,"range":null,"referer":"https://bounceflowers-cuxen9aun-asyncink.vercel.app/","sb_gateway_mode":null,"sb_gateway_version":null,"user_agent":"Mozilla/5.0 (Macintosh | Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.2 Safari/605.1.15","x_client_info":null,"x_forwarded_proto":"https","x_forwarded_user_agent":null,"x_kong_proxy_latency":null,"x_kong_upstream_latency":null,"x_real_ip":"62.217.185.59"}],"host":"jhfjkcfjxvjlvipwubnk.supabase.co","method":"OPTIONS","path":"/rest/v1/orders","port":null,"protocol":"https:","sb":[],"search":"?select=*&order=creationDate.desc","url":"https://jhfjkcfjxvjlvipwubnk.supabase.co/rest/v1/orders?select=*&order=creationDate.desc"}]","2023-12-23T00:07:47.661000"
CURLs for errors above:
curl 'https://jhfjkcfjxvjlvipwubnk.supabase.co/rest/v1/orders?select=*&order=creationDate.desc' \
-X 'GET' \
-H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsImtpZCI6IlZrWGRlbzBhYVM2dC9RN1giLCJ0eXAiOiJKV1QifQ.eyJhdWQiOiJhdXRoZW50aWNhdGVkIiwiZXhwIjoxNzAzODk0NjEzLCJpYXQiOjE3MDMyODk4MTMsImlzcyI6Imh0dHBzOi8vamhmamtjZmp4dmpsdmlwd3Vibmsuc3VwYWJhc2UuY28vYXV0aC92MSIsInN1YiI6ImNlMmMzYzQ5LTJiMmMtNDJlMC05YmE4LTQ4YjlhOWNjMjZkMSIsImVtYWlsIjoiIiwicGhvbmUiOiI3OTE2MTIzMjkzNiIsImFwcF9tZXRhZGF0YSI6eyJwcm92aWRlciI6InBob25lIiwicHJvdmlkZXJzIjpbInBob25lIl19LCJ1c2VyX21ldGFkYXRhIjp7ImVtYWlsIjoidmV0ZXIuYnpAbWUuY29tIiwibmFtZSI6ItCV0LLQs9C10L3QuNC5IiwicmVtaW5kZXJzIjpbXX0sInJvbGUiOiJhdXRoZW50aWNhdGVkIiwiYWFsIjoiYWFsMSIsImFtciI6W3sibWV0aG9kIjoicGFzc3dvcmQiLCJ0aW1lc3RhbXAiOjE3MDMyODk4MTN9XSwic2Vzc2lvbl9pZCI6IjRmMTk1M2E5LWQ5MzItNGNiNi05MDI4LTZjYWZlNWQ5ODdjNiJ9.uREBExZHuwXQPCNWxV0BsScqLg2L9bUoLu2jAafj-Z0' \
-H 'Origin: https://bounceflowers-cuxen9aun-asyncink.vercel.app' \
-H 'Referer: https://bounceflowers-cuxen9aun-asyncink.vercel.app/' \
-H 'Accept: */*' \
-H 'Sec-Fetch-Dest: empty' \
-H 'Sec-Fetch-Mode: cors' \
-H 'Sec-Fetch-Site: cross-site' \
-H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.2 Safari/605.1.15' \
-H 'accept-profile: public' \
-H ‘apikey: ...
curl 'https://jhfjkcfjxvjlvipwubnk.supabase.co/auth/v1/token?grant_type=password' \
-X 'POST' \
-H 'Content-Type: application/json;charset=UTF-8' \
-H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImpoZmprY2ZqeHZqbHZpcHd1Ym5rIiwicm9sZSI6ImFub24iLCJpYXQiOjE2OTcwNzQ0ODgsImV4cCI6MjAxMjY1MDQ4OH0.IesukEnbhxah8oE4FzsBW2dedikAcI3qZH0N2mlCN6w' \
-H 'Origin: https://bounceflowers-cuxen9aun-asyncink.vercel.app' \
-H 'Referer: https://bounceflowers-cuxen9aun-asyncink.vercel.app/' \
-H 'Accept: */*' \
-H 'Sec-Fetch-Dest: empty' \
-H 'Sec-Fetch-Mode: cors' \
-H 'Sec-Fetch-Site: cross-site' \
-H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.2 Safari/605.1.15' \
-H 'apikey: ... \
-H 'X-Client-Info: supabase-js-web/2.39.0' \
--data-binary '{"phone":"+79161232936","password":"870859","gotrue_meta_security":{}}’
curl 'https://jhfjkcfjxvjlvipwubnk.supabase.co/auth/v1/logout?scope=global' \
-X 'POST' \
-H 'Content-Type: application/json;charset=UTF-8' \
-H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsImtpZCI6IlZrWGRlbzBhYVM2dC9RN1giLCJ0eXAiOiJKV1QifQ.eyJhdWQiOiJhdXRoZW50aWNhdGVkIiwiZXhwIjoxNzAzODk0NjEzLCJpYXQiOjE3MDMyODk4MTMsImlzcyI6Imh0dHBzOi8vamhmamtjZmp4dmpsdmlwd3Vibmsuc3VwYWJhc2UuY28vYXV0aC92MSIsInN1YiI6ImNlMmMzYzQ5LTJiMmMtNDJlMC05YmE4LTQ4YjlhOWNjMjZkMSIsImVtYWlsIjoiIiwicGhvbmUiOiI3OTE2MTIzMjkzNiIsImFwcF9tZXRhZGF0YSI6eyJwcm92aWRlciI6InBob25lIiwicHJvdmlkZXJzIjpbInBob25lIl19LCJ1c2VyX21ldGFkYXRhIjp7ImVtYWlsIjoidmV0ZXIuYnpAbWUuY29tIiwibmFtZSI6ItCV0LLQs9C10L3QuNC5IiwicmVtaW5kZXJzIjpbXX0sInJvbGUiOiJhdXRoZW50aWNhdGVkIiwiYWFsIjoiYWFsMSIsImFtciI6W3sibWV0aG9kIjoicGFzc3dvcmQiLCJ0aW1lc3RhbXAiOjE3MDMyODk4MTN9XSwic2Vzc2lvbl9pZCI6IjRmMTk1M2E5LWQ5MzItNGNiNi05MDI4LTZjYWZlNWQ5ODdjNiJ9.uREBExZHuwXQPCNWxV0BsScqLg2L9bUoLu2jAafj-Z0' \
-H 'Origin: https://bounceflowers-cuxen9aun-asyncink.vercel.app' \
-H 'Referer: https://bounceflowers-cuxen9aun-asyncink.vercel.app/' \
-H 'Accept: */*' \
-H 'Sec-Fetch-Dest: empty' \
-H 'Sec-Fetch-Mode: cors' \
-H 'Sec-Fetch-Site: cross-site' \
-H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.2 Safari/605.1.15' \
-H 'apikey: ... \
-H 'X-Client-Info: supabase-js-web/2.39.0'
APIs are called with supabase-js:
await anonSupabase
.from('orders')
.select()
.order('creationDate', { ascending: false })
await anonSupabase.auth.signInWithPassword({
phone,
password
})
await anonSupabase.auth.signOut()
Supabase JS library version:
"@supabase/supabase-js": "^2.39.0"
Safari version is 7.2 (19617.1.17.11.9). No browser extensions installed. It also reproduces in safari on iPhone. This bug is critical, since in some cases all Supabase APIs are unavailable in Safari.
</div>About this issue
- Original URL
- State: open
- Created 3 years ago
- Reactions: 10
- Comments: 18 (2 by maintainers)
Commits related to this issue
- [server] Add workaround for intermittent Safari CORS errors At times, Safari will fail our API responses because its CORS preflight fails. The errors are reproducible, but intermittently, and not on ... — committed to ente-io/ente by mnvr 2 years ago
- [server] Add workaround for intermittent Safari CORS errors (#4540) At times, Safari will fail our API responses because its CORS preflight fails. The errors are reproducible, but intermittently, an... — committed to ente-io/ente by mnvr 2 years ago
@kersson, no, I can confirm that this behavior still reproduces.
Hello. While I am not currently a Supabase user (I did try it out before), I had been facing a similar issue in my current project.
From Google searches, this was the one discussion thread with people having symptoms closest to what I was experiencing.
The symptoms:
What I tried:
What actually fixed it:
Further investigation:
The real fix:
Conclusion:
I’m guessing this is why people are saying it is definitely something with Supabase and that using other intermediate API services can fix it. Supabase probably has HTTP/3 enabled, while other services might not. - Actually, as can be seen in the Supabase logs in the opening post of this thread, the httpProtocol is listed as HTTP/3.
That’s it! Trying to fix and pinpoint this issue has taken up 2 full days of my time. Hope this helps!
Potential counter-example to @src73’s hypothesis: we were experiencing this issue and were able to work around it by creating an intermediate FastAPI service that uses the Supabase python client. Then we pointed our frontend client at that intermediate service and everything works perfectly.
I think this is strong evidence that there is (also) something going on with the responses from Supabase that Safari doesn’t like.
Hi there! Posting what (I think) fixed it for me.
The fix
I had been using Supabase to log some user actions using the following code. The form submission worked perfectly on Safari macOS, Chrome, Firefox, but failed intermittently on Safari iOS 18.1.1.
When the form submission code didn’t work on iOS, it would fail silently with the console logging neither
successnorerr, simplydone. When it didn’t work, it’d fail withFetch API cannot load {supabase URL} due to access control checks.somewhere in the console. There would also be nothing for Supabase in theNetworktab of the Web Inspector. Very confusing.Eventually, I commented out my
log hyperlinkcode and the other Supabase requests started working consistently!Huh? Why?
I had focused on my Supabase code (i.e.
log_event()and the RPC) until I stumbled across this StackOverflow response:Considering my example, it implies that logging on the
<a>click event would cause afetchto fire after the page started unloading (because of the click away from the page). That request would fail, and Safari would decide that future requests like it would fail. Then when the page opened and it tried to log the page load, I would see theFetch API cannot load {supabase URL} due to access control checks.in the vomit of information when the page loads. Then Safari seemed to decide that there’s no point making any requests or throwing any errors when it got to theform submissioncode. Probably this presented as interment because theform submissioncode would work as long as there hadn’t been alog hyperlinklogging event fired (and failed) in the past bit.Sure enough, I commented out my logging event on the
<a>and the other Supabase requests started working consistently.Assuming my version of events is true, the change Supabase needs to make is not fixing its back end (as others here have implied) but instead ensuring it does not fire fetch requests after the page has started unloading.
Other notes
based on @exorman’s comment , I’d previously tried re-writing my Supabase code so that it returned a value (in this instance
ok). While I did see my Supabase writes go to an HTTP Status 200 code (rather than something in the 200s), the code I cared about still didn’t work. I don’t think this mattered.I’d previously changed my code to run
log_event('pageLoad', {})with theDOMContentLoadedevent. The interment failures persisted after I’d made this change, so I don’t think this mattered.I was also running Google Analytics on the page at the same time (the code GA provided was pasted just above the
</body>. Interestingly, I observed a lot ofFetch API cannot load {Google Analytics URL} due to access control checksand failed GA requests. I commented out the GA code for the page and the Supabase fetch errors / interment failures persisted, so I don’t think it mattered.I’m also seeing this issue on Safari 17.3 (19617.2.4.11.8). The error is inconsistent, doesn’t happen all the time.
Using
"@supabase/supabase-js": "^2.45.3".Safari 18.0 and the issue is still present for us. We get
TypeError: Load failedandFetch API cannot load due to access control checkswhen trying to connect to event stream.Any updates on this issue? We’re also encountering the same issue with our Tauri + React app on macOS, which uses
WebKit.framework.@asyncink did you end up finding a solution/workaround?
We were thinking about switching to the GraphQL API instead of the REST API to try to sidestep the issue, but it sounds like that probably won’t work if it affects multiple services.
I tested it with Beta Safari (17.4), the same issue still occurs.
Encountering this problem in my project as well. Hard to describe exactly the effects its having on my project but definitely exclusively on both macOS and iOS. Sentry was reporting a large number of “TypeError: Load Failed” errors specifically for Safari user agents, and it seems to be this access control issue. Weirdly sometimes the user can still continue, it’s hard to tell exactly what’s happening since my login flow involves the supabase sign in + some other db operations to pull necessary info. Sounds like asyncink has a more ideal testing setup. Several users of my project are encountering the issue so seems to at least be independent of any particular version of Safari I would think.
Specific versions of Safari where the issue definitely occurs:
hello! thank you for your reply.
curl never fails since there is no CORS applied for curl requests. it is possible to get response headers via curl, but since we can not get any meaningful error message in Safari, it is hard to debug via curl on my side.
we mentioned safari because this error reproduces only in safari (both macos and ios). I think that problem is not in OPTIONS request itself, but in
fetchimplementation in safari and something configured on supabase server side. for example, this error in webkit is thrown to console if any unexpected error appears. so potentially it could be some headers that are not in webkit spec or smth like this?it is challenging that error appears inconsistently so may be you can assume what can differ from time to time between same requests? other important notice — when the bug appears once, it then appears during whole browser session, page refresh does not make it disappear. we tried to enable and disable VPN connection and change IPs, but it still reproduces inconsistently.
I think that auth settings do not affect/cause this problem, because this bug is something that reproduces rarely and most of the time all requests are OK, users can auth and fetch data from database. but when it appers, all supabase APIs become unaccessible and since supabase is auth and managed database provider — this is critical for application.
our auth settings can be reviewed by our project ID — https://jhfjkcfjxvjlvipwubnk.supabase.co, we can provide any information. we have email auth provider configured and RLS enabled for all databases with configured policies, all these is working fine and as expected until safari fetch fails.
supabase support team suggested by email to downgrade
supabase-jsversion, so we downgraded to2.10.0and can confirm that safari fecth error still reproduces on this version.