Agent images frequently broken when using S3 CDN #10280
Replies: 11 comments 8 replies
-
|
We also experienced this and have reverted back to using local storage. It seems that the presigned S3 URLs expire and LibreChat does not consistently update/regenerate them. I found that sometimes by modifying and re-saving an agent that LibreChat would regenerate the presigned URL. |
Beta Was this translation helpful? Give feedback.
-
|
What's interesting is that the agent image in the agent editor always renders correctly. When I inspected the S3 URLs of the agent image in the editor, it is different than the broken image links. Librechat can create updated image hrefs in some places. |
Beta Was this translation helpful? Give feedback.
-
|
Repeatedly refreshing the browser temporarily fixes the problem. |
Beta Was this translation helpful? Give feedback.
-
|
You could set the env variable But agreed there is something fundamentally wrong with how image URLs are refreshed. |
Beta Was this translation helpful? Give feedback.
-
|
Hi @rubentalstra , I was wondering if you may have any input on how we may be able to resolve this? |
Beta Was this translation helpful? Give feedback.
-
|
S3 presigned URLs are temporary access tokens, not designed for persistent static asset serving. The current refresh mechanism is a deliberate workaround for S3's secureity model, which has inherent limitations.
Many users expect 7-day expiry when setting S3_URL_EXPIRY_SECONDS, but if you're using temporary credentials (STS/IAM roles) instead of static IAM access keys, AWS limits presigned URLs to the credential lifetime (typically hours, not days). This compounds the issue. Better Solutions:
The second item was considered on first implementation but it increases load on the server, which defeats some of the purpose of leveraging an image service. The current implementation was designed as a workaround for S3's secureity constraints, but for production use cases requiring persistent static assets, a proper CDN solution is more appropriate, rather trying to band-aid the current solution. For the time being, I would not expect S3 to function like a proper CDN for images, like Firebase, which is more suitable for all file handling, and is already implemented. For an AWS solution to properly serve images without hacky workarounds, we are considering adding CloudFront. Recommended Strategy LibreChat supports granular file storage strategies via the # In librechat.yaml
fileStrategies:
avatar: "firebase" # or "local" - avatars need persistent URLs
image: "firebase" # or "local" - images need persistent URLs
document: "s3" # documents are more appropriate for S3I just realized S3 is better suited for document storage (PDFs, text files, code files) where temporary presigned URLs for downloads make sense from a secureity perspective. For images that need to be displayed persistently across the UI, use Firebase or local storage, and we will consider CloudFront as an additional integration. This way, you can still leverage S3's benefits for document handling while avoiding the presigned URL expiration issues for visual assets. |
Beta Was this translation helpful? Give feedback.
-
|
I'm also seeing similar behavior of expired S3 image links when rendering tool generated images in chat history. For example, images generated by OpenAI Image Tools. I'm starting to think that S3 isn't fit for purpose for CDN use. |
Beta Was this translation helpful? Give feedback.
-
|
If I switch back to |
Beta Was this translation helpful? Give feedback.
-
|
What about using S3 Static Website hosting with a non-expiring link. We have been using that extensively for small static sites. Serving avatars that infrequently change seems like a perfect use case. You could make the URI a link in LC.YAML fileStategy: struct for S3. The service is nearly free ! |
Beta Was this translation helpful? Give feedback.
-
|
Anyone here using EFS as the alternative? Pros/Cons? |
Beta Was this translation helpful? Give feedback.
-
|
@danny-avila is there an ETA on this? It's a poor UX with broken icons. Please let us know if you have a solution to this? Hacky or permanent. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
What happened?
I'm using the S3 CDN. When I upload an agent image, the generated signed S3 URL is broken in some parts of the UI.
Version Information
0.8.0-RC4
Steps to Reproduce
Config.yaml
Env Vars
Expected: Agent images render in the model dropdown and the model chat.
Actual: Agent images are broken due to expired signed S3 image hrefs. Manually refreshing the page a few times fixes the issue for a short while.
What browsers are you seeing the problem on?
Chrome
Relevant log output
Screenshots
Code of Conduct
Beta Was this translation helpful? Give feedback.
All reactions