Images not loading in your app
Broken images come down to a handful of causes: a path that only works locally, a letter-case mismatch, a private file without a valid link, or an outside host that refuses you.

Key takeaways
- Right-click the broken image and open it in a new tab: the status code (404, 400, 403) tells you which cause you have.
- Images that load for a while and then break are usually signed links to private storage that expired. Store the file path, not the link.
- Paths are case-sensitive on the web. "Hero.PNG" and "hero.png" are different files once published.
When images show as broken icons or empty boxes, the browser asked for a file and got an error back. The most likely cause is a wrong file path: the image lives somewhere other than where the code points, often because the path works in development but not in the published build, or the letter case differs. The second most likely, for user uploads, is a link to private storage that has expired or was never signed.
The one-minute diagnosis
Right-click the broken image and choose "Open image in new tab" (or find the request in the developer tools Network tab, filtered to Img). The response tells you almost everything:
- 404 Not Found: the file is not at that address. Path, case or a file that was never added.
- 400 or 403 with "expired" or "signature" in the body: a signed storage link that is no longer valid.
- 400 or 404 from a storage URL with "object not found" or "bucket not found": wrong bucket name, wrong file path, or a private bucket being read with a public URL.
- 403 from another website: hotlink protection. The other site does not let you embed its images.
- Blocked, "mixed content": an `http://` image on an `https://` page.
- The request never appears: the code never set the image source. A data or rendering bug, not an image problem.
The causes, most likely first
1. The path points to the wrong place
In a Vite and React project there are two ways to use a static image, and mixing them up is the classic mistake. Files in the `public/` folder are served as-is from the site root, so `public/images/logo.png` is referenced as `/images/logo.png` (no `public` in the path). Files elsewhere, such as `src/assets/`, must be imported in code so the build includes them and gives them a hashed name; a hard-coded string like `"src/assets/logo.png"` works by accident in development and breaks once published.
How to check: look at the URL of the failing request. If it contains `/public/` or `/src/`, that is the bug. The fix: put static images in `public/` and reference them from the root, or import them. A relative path such as `images/logo.png` (no leading slash) can also break on nested pages like `/blog/post`, because the browser resolves it to `/blog/images/logo.png`.
2. Letter case does not match
Some computers treat `Hero.PNG` and `hero.png` as the same file. Web hosts do not. How to check: compare the file name in the code with the actual file name, character by character, including the extension. The fix: pick one convention (all lowercase, hyphens instead of spaces) and rename files to match. Spaces in file names work but need encoding (`%20`) and invite mistakes, so avoid them.
3. Expired signed links to private storage
In Startbase Cloud, new storage buckets are always private. To show a private file, the app needs a signed URL, a temporary link with a signature in it. Signed URLs you generate in the Storage section are valid for one hour. If the app saved that full link in the database when the user uploaded a photo, every image works for an hour and then breaks for good.
How to check: the failing URL contains a long `token=` parameter, and the error mentions expiry. Images uploaded just now work; older ones do not. The fix: store the file path (for example `avatars/8c1f.../profile.webp`) in the database, and ask for a fresh signed URL when you display it. For files meant to be public, such as product photos in a shop, a public bucket is simpler: anyone with the file's link can view it, and the link does not expire. Never make a bucket public if it holds anything personal; our guide to storing files and images covers the trade-off.
4. Reading a private bucket with a public URL
The code builds a public URL for a file in a bucket that is private. The file exists, but the public endpoint refuses it. How to check: the URL contains `/object/public/` and the bucket is not marked public in the Storage section. The fix: either make the bucket public (if its contents truly are), or switch the code to signed URLs.
5. The upload never finished
If the database row exists but the file does not, the upload failed after the row was saved. Large phone photos are the usual trigger: a 12-megapixel image can be 5 MB or more, and uploads on mobile data fail more often. How to check: look for the file in the bucket at the stored path. The fix: upload first, save the row only when the upload succeeds, show progress, and resize images in the browser before uploading (about 1600 pixels on the long side is plenty for most apps). Storage access rules can also reject the upload silently; the Logs section, Storage source, shows those errors.
6. Images from another website
Pasting an image address from another site into your app is fragile: the site may block embedding, move the file, or the link may be a temporary one from a search result. The fix: download images you have the right to use and put them in your project, or ask the Startbase agent to generate artwork for you (generated images use Build credits). See AI-generated images for apps.
7. Mixed content
Published sites run on HTTPS. An image with an `http://` address is blocked or upgraded, and fails if the other server has no HTTPS. The fix: use `https://` addresses everywhere, or host the image yourself.
When images load, but slowly
Images that appear one by one, or push the page around as they arrive, are a performance problem rather than a broken one. The Startbase docs suggest keeping images under 200 KB, using WebP for photos and SVG for icons and logos, and always setting width, height and alt text. Width and height reserve the space so the layout does not jump. Add `loading="lazy"` to images below the fold so the first screen loads first.
The message to send the agent
Include the failing URL and the status code. The agent can read your storage setup, your code and the Storage logs:
Profile photos break about an hour after upload. The failing image URLs contain a token and return 400 with "token expired". Please change the app to store only the storage path of each photo in the profiles table, create signed URLs when the photo is displayed, migrate existing rows from full URLs to paths, resize photos to 1600 px on the long side as WebP before uploading, and only save the row after the upload succeeds. Keep the avatars bucket private.
For a static image problem, send the file name, where it sits in the project and the failing URL instead. The Storage docs describe buckets, signed URLs and upload limits.
Frequently asked questions
Why do my images work locally but not after publishing?
Usually a path that only resolves in development (pointing into src/ or public/ by name) or a letter-case mismatch that your computer forgave and the web host does not.
Why do uploaded photos stop showing after an hour?
The app stored a signed link, which expires. Store the file path instead and create a fresh signed link each time the photo is shown.
Should my storage bucket be public or private?
Private for anything personal, such as profile photos, documents or receipts. Public is fine for files anyone may see, such as product images or blog art, and it makes links permanent.
What size should images in a web app be?
As a starting point, under 200 KB each, sized to how large they display, in WebP for photos and SVG for icons.

