FortAwesome / react-fontawesome

Font Awesome React component
https://fontawesome.com
MIT License
3.67k stars 262 forks source link

401 unauthorized downloading svg-core in the cloud w/ free version #545

Open bradherman opened 1 year ago

bradherman commented 1 year ago

Describe the bug

When deploying our site to Cloudflare, we're now seeing a 401 error with the fontawesome-svg-core download.

error An unexpected error occurred: "https://npm.fontawesome.com/@fortawesome/fontawesome-svg-core/-/6.2.0/fontawesome-svg-core-6.2.0.tgz: Request failed \"401 Unauthorized\"".

Reproducible test case

Not sure how to show a test case for this without deploying to Cloudflare.

Expected behavior

This uses the free fontawesome package and therefore shouldn't need any auth token

Desktop (please complete the following information):

"@fortawesome/fontawesome-free": "6.2.0",
"@fortawesome/fontawesome-svg-core": "6.2.0",
"@fortawesome/free-regular-svg-icons": "6.2.0",
"@fortawesome/free-solid-svg-icons": "6.2.0",

Additional context

Using yarn

svondervoort commented 1 year ago

Finally found out what the issue was for me.

Check your yarn.lock and look for npm.fortawsome.com if it is in the yarn.lock you probably have set up a global NPM config token like this:

npm config set "@fortawesome:registry" https://npm.fontawesome.com/
npm config set "//npm.fontawesome.com/:_authToken" FONT-AWESOME-PACKAGE-FONT-AWESOME-PACKAGE-TOKEN

Replace set with rm to remove those entries from the npm config, do a yarn remove %package% to uninstall all those font-awesome related packages and install them again. Now it should be something like this in the yarn.lock for the font-awesome packages: "https://registry.yarnpkg.com/@fortawesome/.