Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Yarn Registry always returns 503 Unavailable

For the past 2 days I've been having an issue when deploying my Rails+React app to Heroku. The issue is intermittent (sometimes I can deploy), which makes me think that it's an issue with Heroku connecting to the yarn registry.

When I go to the registry https://registry.yarnpkg.com, everything appears to work fine. When I go to Heroku's status page (https://status.heroku.com/) they don't say they have any issues.

Is this something wrong with my code base? Should I setup a yarn mirror?

Below is my console log. It always fails at some point, but with different packages each time.

-----> Ruby app detected
-----> Compiling Ruby/Rails
-----> Using Ruby version: ruby-2.3.7
-----> Installing dependencies using bundler 1.15.2
       Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
       Warning: the running version of Bundler (1.15.2) is older than the version that created the lockfile (1.16.2). We suggest you upgrade to the latest version of Bundler by running `gem install bundler`.
       Fetching gem metadata from https://rubygems.org/............
       Fetching version metadata from https://rubygems.org/..
       Fetching dependency metadata from https://rubygems.org/.
       Using rake 12.3.1
       Using concurrent-ruby 1.0.5
       Using minitest 5.11.3
       Using thread_safe 0.3.6
       Using builder 3.2.3
       Using erubi 1.7.1
       Using mini_portile2 2.3.0
       Using crass 1.0.4
       Using rack 2.0.5
       Using nio4r 2.3.1
       Using websocket-extensions 0.1.3
       Using mini_mime 1.0.0
       Using arel 8.0.0
       Using execjs 2.7.0
       Using aws-sigv4 1.0.2
       Using jmespath 1.4.0
       Using babel-source 5.8.35
       Using bcrypt 3.1.12
       Using popper_js 1.12.9
       Using rb-fsevent 0.10.3
       Using ffi 1.9.23
       Using bundler 1.15.2
       Using coffee-script-source 1.12.2
       Using method_source 0.9.0
       Using thor 0.20.0
       Using connection_pool 2.2.1
       Using orm_adapter 0.5.0
       Using unf_ext 0.0.7.5
       Using multipart-post 2.0.0
       Using multi_json 1.13.1
       Using mime-types-data 3.2016.0521
       Using mini_magick 4.8.0
       Using mustermann 1.0.2
       Using netrc 0.11.0
       Using pg 1.0.0
       Using puma 3.11.4
       Using tilt 2.0.8
       Using turbolinks-source 5.1.0
       Using tzinfo 1.2.5
       Using nokogiri 1.8.2
       Using websocket-driver 0.6.5
       Using mail 2.7.0
       Using i18n 1.0.1
       Using autoprefixer-rails 8.5.0
       Using uglifier 4.1.10
       Using rack-test 1.0.0
       Using warden 1.2.7
       Using rack-protection 2.0.1
       Using rack-proxy 0.6.4
       Using sprockets 3.7.1
       Using babel-transpiler 0.7.0
       Using aws-sdk-core 2.11.58
       Using rb-inotify 0.9.10
       Using coffee-script 2.4.1
       Using unf 0.1.4
       Using faraday 0.15.2
       Using mime-types 3.1
       Using turbolinks 5.1.1
       Using activesupport 5.1.6
       Using loofah 2.2.2
       Using sinatra 2.0.1
       Using sass-listen 4.0.0
       Using aws-sdk-resources 2.11.58
       Using domain_name 0.5.20180417
       Using sentry-raven 2.7.3
       Using rails-dom-testing 2.0.3
       Using globalid 0.4.1
       Using activemodel 5.1.6
       Using jbuilder 2.7.0
       Using sass 3.5.6
       Using rails-html-sanitizer 1.0.4
       Using aws-sdk 2.11.58
       Using http-cookie 1.0.3
       Using activerecord 5.1.6
       Using actionview 5.1.6
       Using rest-client 2.0.2
       Using activejob 5.1.6
       Using friendly_id 5.1.0
       Using actionpack 5.1.6
       Using bootstrap 4.1.1
       Using refile 0.6.2 from https://github.com/manfe/refile.git (at master@46b4178)
       Using actioncable 5.1.6
       Using actionmailer 5.1.6
       Using railties 5.1.6
       Using sprockets-rails 3.2.1
       Using simple_form 4.0.1
       Using refile-mini_magick 0.2.0
       Using refile-s3 0.2.0
       Using coffee-rails 4.2.2
       Using responders 2.4.0
       Using font-awesome-rails 4.7.0.4
       Using jquery-rails 4.3.3
       Using react-rails 2.4.4
       Using webpacker 3.5.3
       Using rails 5.1.6
       Using sass-rails 5.0.7
       Using devise 4.4.3
       Bundle complete! 29 Gemfile dependencies, 97 gems now installed.
       Gems in the groups development and test were not installed.
       Bundled gems are installed into ./vendor/bundle.
       Bundle completed (5.27s)
       Cleaning up the bundler cache.
       Warning: the running version of Bundler (1.15.2) is older than the version that created the lockfile (1.16.2). We suggest you upgrade to the latest version of Bundler by running `gem install bundler`.
       The latest bundler is 1.16.2, but you are currently running 1.15.2.
       To update, run `gem install bundler`
-----> Installing node-v8.10.0-linux-x64
-----> Installing yarn-v1.5.1
-----> Detecting rake tasks
-----> Preparing app for Rails asset pipeline
       Running: rake assets:precompile
       W, [2018-06-06T15:12:59.637954 #408]  WARN -- sentry: ** [Raven] You are running on Heroku but haven't enabled Dyno Metadata. For Sentry's release detection to work correctly, please run `heroku labs:enable runtime-dyno-metadata`
       yarn install v1.5.1
       [1/4] Resolving packages...
       [2/4] Fetching packages...
       error An unexpected error occurred: "https://registry.yarnpkg.com/pump/-/pump-2.0.1.tgz: Request failed \"503 Service Unavailable\"".
       info If you think this is a bug, please open a bug report with the information provided in "/tmp/build_fb670161fa41f98e3b1b96e827ab0a9e/yarn-error.log".
       info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
       Webpacker is installed 🎉 🍰
       Using /tmp/build_fb670161fa41f98e3b1b96e827ab0a9e/config/webpacker.yml file for setting up webpack paths
       Compiling…
       Compilation failed:
       /tmp/build_fb670161fa41f98e3b1b96e827ab0a9e/vendor/bundle/ruby/2.3.0/gems/webpacker-3.5.3/lib/webpacker/webpack_runner.rb:11:in `exec': No such file or directory - /tmp/build_fb670161fa41f98e3b1b96e827ab0a9e/node_modules/.bin/webpack (Errno::ENOENT)
        from /tmp/build_fb670161fa41f98e3b1b96e827ab0a9e/vendor/bundle/ruby/2.3.0/gems/webpacker-3.5.3/lib/webpacker/webpack_runner.rb:11:in `block in run'
        from /tmp/build_fb670161fa41f98e3b1b96e827ab0a9e/vendor/bundle/ruby/2.3.0/gems/webpacker-3.5.3/lib/webpacker/webpack_runner.rb:10:in `chdir'
        from /tmp/build_fb670161fa41f98e3b1b96e827ab0a9e/vendor/bundle/ruby/2.3.0/gems/webpacker-3.5.3/lib/webpacker/webpack_runner.rb:10:in `run'
        from /tmp/build_fb670161fa41f98e3b1b96e827ab0a9e/vendor/bundle/ruby/2.3.0/gems/webpacker-3.5.3/lib/webpacker/runner.rb:6:in `run'
        from ./bin/webpack:15:in `<main>'


 !
 !     Precompiling assets failed.
 !
 !     Push rejected, failed to compile Ruby app.
 !     Push failed
```
like image 780
Elijah Murray Avatar asked Oct 28 '22 11:10

Elijah Murray


1 Answers

This could be related to npmjs.org registry failing to answer some requests, and returning 503 intermittently.

It seems that "Yarn's backend is simply a reverse proxy over the top of npm's one. It's powered by CloudFlare" (quoting from: https://github.com/yarnpkg/yarn/issues/3804).

Chances are high that neither Heroku or Yarn are responsible for this. I recommend checking https://status.npmjs.org/ for potential updates on the issues you're experiencing, especially this ticket: Intermittent 503's status returns which was just opened.

like image 185
jbmusso Avatar answered Jan 07 '23 12:01

jbmusso