Back

[SOLVED] Unable to load images when hosted on Vercel

  • 0
  • Web
  • Storage
Toli
20 Nov, 2023, 21:48

I use Appwrite storage to store some images and generate previews for them. When I develop my React app locally, all works well. However when I deploy it to Vercel, images won't load and I get the 401 unauthorized response from the server.

I've added Vercel deploymnet to my platforms, and otherwise contacting Appwrite works (e.g. to work with the database).

TL;DR
Issue: Unable to load images when hosted on Vercel Solution: The problem is likely caused by third-party cookie restrictions in modern browsers. To resolve this, try the following steps: 1. Give any permissions to the image file to address the issue. 2. Try accessing the website in incognito mode. 3. Log out and back in to the application to see if that resolves the problem. 4. Check if the fallbackCookies are stored in the browser under the localhost but not the deployed website's host. If none of these steps work, it may be necessary to purchase a custom domain to prevent third-party cookie issues.
Toli
20 Nov, 2023, 22:43

Update: for some reason, when I logged out and back in to my application, it worked. I suspect has to do something with the fallbackCookies: e.g. they could have been stored in the browser under the localhost but not the deployed website's host...

Toli
20 Nov, 2023, 23:20

Update 2: from the mobile device, the workaround of logging out and back in did not work.

Drake
21 Nov, 2023, 01:33

You might be running into a 3rd party cookie problem. see https://appwrite.io/docs/custom-domains

Aditya Oberai
21 Nov, 2023, 01:44

Were you able to try in incognito mode once?

VincentGe
21 Nov, 2023, 03:06

<:plusone:775475804431581286>

VincentGe
21 Nov, 2023, 03:07

Can you try giving any permissions to the file and see if that addresses the issue? If it does, it might be a 3rd party cookie problem

Toli
21 Nov, 2023, 06:55

Setting the permission of the database to Any solved it. So to prevent the 3rd party cookies issue, the only way is to own a custom domain? Is there any way to resolve this problem without purchasing a domain and without setting the permissions to Any?

D5
21 Nov, 2023, 08:38

Yes and not possible

D5
21 Nov, 2023, 08:38

A domain is needed for first party cookies

Toli
21 Nov, 2023, 08:44

[SOLVED] Unable to load images when hosted on Vercel

VincentGe
21 Nov, 2023, 14:22

Yeah so third party cookies is a problem caused by new security features of modern browsers

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more