Search code examples
ruby-on-railsruby-on-rails-7import-maps

How to use rails 7 importmaps with proxy


In rails 6 we set the proxy like e.g.

npm config set proxy http://localhost:3128/ -g

or by setting env variable http_proxy and https_proxy.

When using rails 7 and importmaps I get the following error when I execute

./bin/importmap pin <package>

importmap-rails-1.1.2/lib/importmap/packager.rb:69:in `rescue in post_json': Unexpected transport error (Net::HTTPServerException: 407 "AuthorizedOnly") (Importmap::Packager::HTTPError)

How do I set the proxy when using importmaps?


Solution

  • TL;DR; importmap does use the proxy, problem was in proxy config

    Answer:

    It turned out to be a layer 8 issue.

    importmap does use the proxy declared in http_proxy/https_proxy.

    My issue was that the password hash for cntlm was no longer valid, I recreated the hash and importmap worked perfectly fine.