Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prefer a stable CDN over IPFS #2934

Open
9 of 10 tasks
SukkaW opened this issue Jun 3, 2024 · 11 comments · May be fixed by #3109
Open
9 of 10 tasks

Prefer a stable CDN over IPFS #2934

SukkaW opened this issue Jun 3, 2024 · 11 comments · May be fixed by #3109
Assignees
Labels
c: bug Something isn't working has workaround Workaround provided or linked m: image Something is referring to the image module p: 1-normal Nothing urgent

Comments

@SukkaW
Copy link

SukkaW commented Jun 3, 2024

Pre-Checks

Describe the bug

I am using faker.image.avatar() method to get a random avatar URL.

The method returns a random IPFS URL: https://cloudflare-ipfs.com/ipfs/Qmd3W5DuhgHirLHGVixi6V76LhCkZUz6pnFt5AJBiyvHye/avatar/269.jpg

But to my surprise, the Cloudflare IPFS Gateway returns 504 error:

image

The IPFS gateway itself is working, but the asset can not be fetched by the gateway from the IPFS network.

Minimal reproduction code

No response

Additional Context

IMHO IPFS Gateway might not be that stable after all, faker-js could publish the random assets on a dedicated GitHub repo and use jsDelivr (or any other CDN) to deliver them.

Environment Info

System:
    OS: Linux 6.8 Fedora Linux 40 (Workstation Edition)
    CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 11.70 GB / 31.03 GB
    Container: Yes
    Shell: 5.9 - /usr/bin/zsh
  Binaries:
    Node: 18.19.0 - /run/user/1000/fnm_multishells/174660_1717401217872/bin/node
    npm: 10.2.3 - /run/user/1000/fnm_multishells/174660_1717401217872/bin/npm
    pnpm: 8.15.8 - /run/user/1000/fnm_multishells/174660_1717401217872/bin/pnpm
    bun: 1.1.10 - ~/.npm-global/bin/bun
  Browsers:
    Chrome: 125.0.6422.141

Which module system do you use?

  • CJS
  • ESM

Used Package Manager

pnpm

@SukkaW SukkaW added c: bug Something isn't working s: pending triage Pending Triage labels Jun 3, 2024
@SukkaW
Copy link
Author

SukkaW commented Jun 3, 2024

See also #2598.

@ST-DDT
Copy link
Member

ST-DDT commented Jun 3, 2024

Which version of Faker are you using?

The link seems to work fine for me, this might be a temporary problem. We plan to replace the legacy set in the future.

Workaround: Use avatarGithub() instead.

@SukkaW
Copy link
Author

SukkaW commented Jun 3, 2024

Which version of Faker are you using?

I am using @faker-js/[email protected]

The link seems to work fine for me, this might be a temporary problem. We plan to replace the legacy set in the future.

Sure. In the meantime, I propose faker could publish assets on a dedicated GitHub repo, and deliver them through a more stable GitHub CDN like jsDelivr or Statically.io, unlike the IPFS which requires maintaining an infra to pin the file over the IPFS network (Like seeding with the BitTorrent).

@Shinigami92
Copy link
Member

As I already raised the idea of generating new person face images via Stable Diffusion and I do have now a good graphic card available, I will assign me to this issue
However I will also either add a note for the upcoming team meeting about this topic or we (team/part of team) might discuss a bit about the process and how to effectively store these generated data (e.g. also persisting info/meta about how the images were generated and their prompts)

@Shinigami92 Shinigami92 self-assigned this Jun 3, 2024
@ST-DDT
Copy link
Member

ST-DDT commented Jun 4, 2024

Related issue:

@ST-DDT ST-DDT added has workaround Workaround provided or linked p: 1-normal Nothing urgent m: image Something is referring to the image module labels Jun 4, 2024
@xDivisionByZerox xDivisionByZerox removed the s: pending triage Pending Triage label Jul 6, 2024
@teddis
Copy link

teddis commented Sep 14, 2024

I receive access denied. Is faker.image.avatar() deprecated? faker.image.avatarGitHub() sadly returns block art.

@ST-DDT
Copy link
Member

ST-DDT commented Sep 14, 2024

I receive access denied.

Looks like cloudflare shut down that legacy image set.
We don't have control over that list, so there is nothing we can do about it (other than removing the legacy image set links).

Is faker.image.avatar() deprecated?

No, its not. We probably have to remove the legacy images from it though.

faker.image.avatarGitHub() sadly returns block art.

Not exclusively, but sadly a lot of times.
You could try the imageUrl method with a portrait category as well. Not sure how good that works.

@SukkaW
Copy link
Author

SukkaW commented Sep 14, 2024

Looks like cloudflare shut down that legacy image set.

As I mentioned, we could use a stable CDN. Maybe we could ask @jimaek for jsDelivr's opinion on this.

@ST-DDT
Copy link
Member

ST-DDT commented Sep 14, 2024

Looks like cloudflare shut down that legacy image set.

As I mentioned, we could use a stable CDN. Maybe we could ask @jimaek for jsDelivr's opinion on this.

We don't own it, so we cannot bring it back as is.

We could create a new image set, but that is covered by #465 and for that we will use a stable CDN/plattform.
Any suggestion regarding free CDN options for hosting the images would be appreciated in that issue.

@ST-DDT ST-DDT linked a pull request Sep 14, 2024 that will close this issue
@ST-DDT ST-DDT linked a pull request Sep 14, 2024 that will close this issue
@ST-DDT
Copy link
Member

ST-DDT commented Sep 14, 2024

I created #3109 to deprecate the avatarLegacy method for removal.

@ST-DDT
Copy link
Member

ST-DDT commented Sep 14, 2024

faker.image.avatarGitHub() sadly returns block art.

You could try the following instead:

faker.image.urlLoremFlickr({ category: 'portrait', width: 400, height: 400 })

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: bug Something isn't working has workaround Workaround provided or linked m: image Something is referring to the image module p: 1-normal Nothing urgent
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants