LasseRafn / ui-avatars

MIT License
1.05k stars 138 forks source link

Multiple parameters causing API to generate no image and break in production #44

Closed udaysinghcode closed 4 years ago

udaysinghcode commented 4 years ago

Hi everyone, I'm finding some errors with this API in production, particularly when I add a size parameter to the following URL:

This runs fine before I add the sizing:

https://ui-avatars.com/api/?name=Bob+Alice&background=0D8ABC&color=fff&rounded=true

This breaks when I add sizing: https://ui-avatars.com/api/?name=Bob+Alice&background=0D8ABC&color=fff&rounded=true&size=256

This used to work before, but suddenly it's failing.

Here's the reverse:

This works with the sizing: https://ui-avatars.com/api/?name=Bob+Alice&size=256&rounded=true

This breaks when I add the colors: https://ui-avatars.com/api/?name=Bob+Alice&size=256&rounded=true&&background=0D8ABC&color=fff

I'm not entirely sure what's going on, but it's definitely strange.

karlerss commented 4 years ago

Having same issues. Storage/cache?

udaysinghcode commented 4 years ago

Yeah, all my old ones seem to be running alright. Anything that had been built before is returning, it's new images that are breaking. I pulled the repo, but can't seem to find anything. My suspicion is that it's a cache issue, but will wait for @LasseRafn to chime in!

Valkyrurr commented 4 years ago

Happening to me as well. Noticed that it only breaks when color and/or background is added.

Works: https://ui-avatars.com/api/?name=John+Doe&rounded=true&bold=true

Breaks: https://ui-avatars.com/api/?name=John+Doe&rounded=true&bold=true&color=0D8ABC https://ui-avatars.com/api/?name=John+Doe&rounded=true&bold=true&background=0D8ABC

udaysinghcode commented 4 years ago

@Valkyrurr - that's super interesting, because check this out: https://ui-avatars.com/api/?name=John+Doe&background=0D8ABC&color=fff&rounded=true

If I move your rounded to the end, it's suddenly passing.

Valkyrurr commented 4 years ago

Woah. I'm not even using the rounded parameter in my current implementation. Some hex values just do not work though... e2430a for example. I'm pretty sure these values worked before, for atleast months on using this API.

udaysinghcode commented 4 years ago

Likewise, I'm feeling like @karlerss is probably on the money here, but hard to debug without being able to look at the logs. I'm sure @LasseRafn will know what's up (and thank you, of course for hosting this incredibly useful API).

LasseRafn commented 4 years ago

Thats super strange! let me dig into it — thanks for doing all the debugging

LasseRafn commented 4 years ago

Okay so as Issue #45 points out, its simply related to server storage. Every image is cached for a period of time — however as of now (5 minutes ago) we had 214.007.808 images stored (causing the storage to be full 😅

I'll be implementing a better cleanup job and in the meantime simply clean images more frequently!

Sorry

vishnutk commented 4 years ago

https://ui-avatars.com/api/Michele%20Vodaro/400/333941/FFFFFF stopped suddently for me and giving The image <> can not be displayed because it contain errors message. Image seems to be started loading again. Any inputs?

Valkyrurr commented 4 years ago

I'll be implementing a better cleanup job and in the meantime simply clean images more frequently!

Seems like that fixes it. Thank you, @LasseRafn !

LasseRafn commented 4 years ago

Follow-up: I setup alerts for disk-space (and other key metrics) so this will be caught before it happens (if it does) in the future

Screenshot 2020-05-26 12 26 31

Next up is:

udaysinghcode commented 4 years ago

Thanks a ton! Looks great!

jaragones commented 3 years ago

Hey @LasseRafn ! Can it be that issue generating new images is back?

This url works: https://eu.ui-avatars.com/api/?name=JA&rounded=true&background=ffffff&color=1590E3&bold=true&font-size=0.65

But this ones doesn't: https://eu.ui-avatars.com/api/?name=LA&rounded=true&background=ffffff&color=1590E3&bold=true&font-size=0.65