I'm getting 401 errors while trying to deploy on Heroku
error An unexpected error occurred: "https://npm.fontawesome.com/@fortawesome/free-regular-svg-icons/-/free-regular-svg-icons-5.1.0-11.tgz: Request failed "401 Unauthorized"".
Deploy without errors
Version: 5.1.0-11
Browser and version: does not apply
You need a Heroku account
Output log:
-----> Deleting 6 files matching .slugignore patterns.
-----> ActiveStorage Preview app detected
-----> Installing binary dependencies for ActiveStorage Preview
Downloading packages..
Installing packages...
-----> Node.js app detected
-----> Creating runtime environment
NPM_CONFIG_LOGLEVEL=error
NODE_VERBOSE=false
NODE_ENV=production
NODE_MODULES_CACHE=true
-----> Installing binaries
engines.node (package.json): ^10.0.0
engines.npm (package.json): unspecified (use default)
engines.yarn (package.json): ^1.7.0
Resolving node version ^10.0.0...
Downloading and installing node 10.4.0...
Using default npm version: 6.1.0
Resolving yarn version ^1.7.0...
Downloading and installing yarn (1.7.0)...
Installed yarn 1.7.0
-----> Restoring cache
Skipping cache restore (not-found)
-----> Building dependencies
Installing node modules (yarn.lock)
yarn install v1.7.0
[1/4] Resolving packages...
[2/4] Fetching packages...
(node:525) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
error An unexpected error occurred: "https://npm.fontawesome.com/@fortawesome/free-regular-svg-icons/-/free-regular-svg-icons-5.1.0-11.tgz: Request failed "401 Unauthorized"".
info If you think this is a bug, please open a bug report with the information provided in "/tmp/build_84afda399a5fefa093019f17e10c7b39/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
-----> Build failed
We're sorry this build is failing! You can troubleshoot common issues here:
https://devcenter.heroku.com/articles/troubleshooting-node-deploys
If you're stuck, please submit a ticket so we can help:
https://help.heroku.com/
Love,
Heroku
! Push rejected, failed to compile Node.js app.
! Push failed
It fails on different packages everytime I try.
It seems to depend on Font Awesome, because the installation is fine when I do not include fontawesome in package.json
Relevant source code:
@tagliala the npm.fontawesome.com
snuck into the yarn.lock
. It would be reasonable if we didn't require the auth token for the free packages but we'd be shouldering potentially a lot of traffic to do that. I'll think about the underlying issue with Mike. Thank you sir.
@robmadole thanks!
Got it 🤦♂️ . The registry from the global ~/.npmrc
snuck into the yarn.lock
on this project and I didn't know that the free version is restricted (I agree on the choice, fwiw).
I'm going to remove the repository setting from the global configuration
Can I close this one or there is something you should do?
@robmadole @tagliala I seem to be having a very similar issue, except that you two seem to have come to a satisfying resolution and exchanged information telepathically and I'm not picking up what you both seemed to intuitively understand. Help!
I am a FA Pro user with a Rails 5.2 + webpacker + yarn + Sass app that works great in development mode. When I try to deploy to Heroku, I'm getting the 401 Unauthorized even though I've added my app's herokuapp.com domain to my whitelist on the FA CDN control panel. I have my FA Pro credentials set up globally on my local dev environment.
When I look at yarn.lock I see the npm.fontawesome.com package entries for fontawesome-pro, fontawesome-pro-solid and fontawesome-common-types. My understanding of yarn is that it uses the rpm repositories behind the scenes; indeed, the FA how-to for yarn directly references using the rpm repositories.
SOLVED
I had to switch to the "Per-Project" instructions and create a .npmrc file in my project root.
I strongly suggest that you guys update the documentation to suggest that if you're deploying, global is likely not going to be a viable strategy. :heart:
I was getting a 404 error when deploying to Heroku, and switching to a "Per-Project" setup (creating a .npmrc file) also fixed the problem for me.
Oh yes, please use per-project settings when dealing with Font Awesome Pro: Heroku must know the auth token.
The problem is when on your local machine you have a global setting for Font Awesome PRO and you are using Font Awesome free on other projects. This is not an issue of Font Awesome
If you're using the FontAwesome Free edition, try removing any .lock file (yarn.lock, package.lock) and .npmrc when committing to your repo and let Heroku figure them out by itself.
Same here, using the Per-Project setup solved the issue.
Most helpful comment
If you're using the FontAwesome Free edition, try removing any .lock file (yarn.lock, package.lock) and .npmrc when committing to your repo and let Heroku figure them out by itself.