importmap-rails
importmap-rails copied to clipboard
Unpin command causing net error
Trying to get rid of a difficult pin (see previous issue #223). Surprised it crashes out with an error. Why would unpin, which presumably just removes a line in a file, have to hit the Net (and why would it fail when the net is working fine)?
scott@ubuntu22-37:~/ror-apps/elc3$ bin/importmap unpin uikit-icons
/usr/share/rvm/gems/ruby-3.1.4/gems/importmap-rails-1.2.3/lib/importmap/packager.rb:69:in `rescue in post_json': Unexpected transport error (Net::ReadTimeout: Net::ReadTimeout with #<TCPSocket:(closed)>) (Importmap::Packager::HTTPError)
from /usr/share/rvm/gems/ruby-3.1.4/gems/importmap-rails-1.2.3/lib/importmap/packager.rb:66:in `post_json'
from /usr/share/rvm/gems/ruby-3.1.4/gems/importmap-rails-1.2.3/lib/importmap/packager.rb:21:in `import'
from /usr/share/rvm/gems/ruby-3.1.4/gems/importmap-rails-1.2.3/lib/importmap/commands.rb:44:in `unpin'
from /usr/share/rvm/gems/ruby-3.1.4/gems/thor-1.3.0/lib/thor/command.rb:28:in `run'
from /usr/share/rvm/gems/ruby-3.1.4/gems/thor-1.3.0/lib/thor/invocation.rb:127:in `invoke_command'
from /usr/share/rvm/gems/ruby-3.1.4/gems/thor-1.3.0/lib/thor.rb:527:in `dispatch'
from /usr/share/rvm/gems/ruby-3.1.4/gems/thor-1.3.0/lib/thor/base.rb:584:in `start'
from /usr/share/rvm/gems/ruby-3.1.4/gems/importmap-rails-1.2.3/lib/importmap/commands.rb:147:in `<main>'
from /usr/share/rvm/gems/ruby-3.1.4/gems/bootsnap-1.17.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
from /usr/share/rvm/gems/ruby-3.1.4/gems/bootsnap-1.17.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
from /usr/share/rvm/gems/ruby-3.1.4/gems/zeitwerk-2.6.12/lib/zeitwerk/kernel.rb:38:in `require'
from bin/importmap:4:in `<main>'
/usr/share/rvm/gems/ruby-3.1.4/gems/net-protocol-0.2.2/lib/net/protocol.rb:229:in `rbuf_fill': Net::ReadTimeout with #<TCPSocket:(closed)> (Net::ReadTimeout)
from /usr/share/rvm/gems/ruby-3.1.4/gems/net-protocol-0.2.2/lib/net/protocol.rb:199:in `readuntil'
from /usr/share/rvm/gems/ruby-3.1.4/gems/net-protocol-0.2.2/lib/net/protocol.rb:209:in `readline'
from /usr/share/rvm/rubies/ruby-3.1.4/lib/ruby/3.1.0/net/http/response.rb:42:in `read_status_line'
from /usr/share/rvm/rubies/ruby-3.1.4/lib/ruby/3.1.0/net/http/response.rb:31:in `read_new'
from /usr/share/rvm/rubies/ruby-3.1.4/lib/ruby/3.1.0/net/http.rb:1609:in `block in transport_request'
from /usr/share/rvm/rubies/ruby-3.1.4/lib/ruby/3.1.0/net/http.rb:1600:in `catch'
from /usr/share/rvm/rubies/ruby-3.1.4/lib/ruby/3.1.0/net/http.rb:1600:in `transport_request'
from /usr/share/rvm/rubies/ruby-3.1.4/lib/ruby/3.1.0/net/http.rb:1573:in `request'
from /usr/share/rvm/rubies/ruby-3.1.4/lib/ruby/3.1.0/net/http.rb:1587:in `send_entity'
from /usr/share/rvm/rubies/ruby-3.1.4/lib/ruby/3.1.0/net/http.rb:1375:in `post'
from /usr/share/rvm/rubies/ruby-3.1.4/lib/ruby/3.1.0/net/http.rb:525:in `block in post'
from /usr/share/rvm/rubies/ruby-3.1.4/lib/ruby/3.1.0/net/http.rb:985:in `start'
from /usr/share/rvm/rubies/ruby-3.1.4/lib/ruby/3.1.0/net/http.rb:628:in `start'
from /usr/share/rvm/rubies/ruby-3.1.4/lib/ruby/3.1.0/net/http.rb:523:in `post'
from /usr/share/rvm/gems/ruby-3.1.4/gems/importmap-rails-1.2.3/lib/importmap/packager.rb:67:in `post_json'
from /usr/share/rvm/gems/ruby-3.1.4/gems/importmap-rails-1.2.3/lib/importmap/packager.rb:21:in `import'
from /usr/share/rvm/gems/ruby-3.1.4/gems/importmap-rails-1.2.3/lib/importmap/commands.rb:44:in `unpin'
from /usr/share/rvm/gems/ruby-3.1.4/gems/thor-1.3.0/lib/thor/command.rb:28:in `run'
from /usr/share/rvm/gems/ruby-3.1.4/gems/thor-1.3.0/lib/thor/invocation.rb:127:in `invoke_command'
from /usr/share/rvm/gems/ruby-3.1.4/gems/thor-1.3.0/lib/thor.rb:527:in `dispatch'
from /usr/share/rvm/gems/ruby-3.1.4/gems/thor-1.3.0/lib/thor/base.rb:584:in `start'
from /usr/share/rvm/gems/ruby-3.1.4/gems/importmap-rails-1.2.3/lib/importmap/commands.rb:147:in `<main>'
from /usr/share/rvm/gems/ruby-3.1.4/gems/bootsnap-1.17.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
from /usr/share/rvm/gems/ruby-3.1.4/gems/bootsnap-1.17.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
from /usr/share/rvm/gems/ruby-3.1.4/gems/zeitwerk-2.6.12/lib/zeitwerk/kernel.rb:38:in `require'
from bin/importmap:4:in `<main>'
scott@ubuntu22-37:~/ror-apps/elc3$ bin/importmap json
{
"imports": {
"application": "/assets/application-c3a75288f3c99855d6dcc79c817142f6ca3394717c56a6faf84461998c021ad6.js",
"@hotwired/turbo-rails": "/assets/turbo.min-dfd93b3092d1d0ff56557294538d069bdbb28977d3987cb39bc0dd892f32fc57.js",
"@hotwired/stimulus": "/assets/stimulus.min-dd364f16ec9504dfb72672295637a1c8838773b01c0b441bd41008124c407894.js",
"@hotwired/stimulus-loading": "/assets/stimulus-loading-3576ce92b149ad5d6959438c6f291e2426c86df3b874c525b30faad51b0d96b3.js",
"uikit-icons": "/assets/uikit/dist/js/uikit-icons-b707ddc845e81bb120304ca33763c5db844f20ff9067cce0cf517f834791c930.js",
"controllers/active_options_controller": "/assets/controllers/active_options_controller-14ef8db945c188ffa95c2ab20a0c51b5a12557d604bcd9934399e7efd179cde3.js",
"controllers/application": "/assets/controllers/application-368d98631bccbf2349e0d4f8269afb3fe9625118341966de054759d96ea86c7e.js",
"controllers/hello_controller": "/assets/controllers/hello_controller-549135e8e7c683a538c3d6d517339ba470fcfb79d62f738a0a089ba41851a554.js",
"controllers": "/assets/controllers/index-2db729dddcc5b979110e98de4b6720f83f91a123172e87281d5a58410fc43806.js"
}
}
scott@ubuntu22-37:~/ror-apps/elc3$ bin/importmap unpin uikit-icons
/usr/share/rvm/gems/ruby-3.1.4/gems/importmap-rails-1.2.3/lib/importmap/packager.rb:80:in `handle_failure_response': Unexpected response code (503) (Importmap::Packager::HTTPError)
from /usr/share/rvm/gems/ruby-3.1.4/gems/importmap-rails-1.2.3/lib/importmap/packager.rb:31:in `import'
from /usr/share/rvm/gems/ruby-3.1.4/gems/importmap-rails-1.2.3/lib/importmap/commands.rb:44:in `unpin'
from /usr/share/rvm/gems/ruby-3.1.4/gems/thor-1.3.0/lib/thor/command.rb:28:in `run'
from /usr/share/rvm/gems/ruby-3.1.4/gems/thor-1.3.0/lib/thor/invocation.rb:127:in `invoke_command'
from /usr/share/rvm/gems/ruby-3.1.4/gems/thor-1.3.0/lib/thor.rb:527:in `dispatch'
from /usr/share/rvm/gems/ruby-3.1.4/gems/thor-1.3.0/lib/thor/base.rb:584:in `start'
from /usr/share/rvm/gems/ruby-3.1.4/gems/importmap-rails-1.2.3/lib/importmap/commands.rb:147:in `<main>'
from /usr/share/rvm/gems/ruby-3.1.4/gems/bootsnap-1.17.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
from /usr/share/rvm/gems/ruby-3.1.4/gems/bootsnap-1.17.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
from /usr/share/rvm/gems/ruby-3.1.4/gems/zeitwerk-2.6.12/lib/zeitwerk/kernel.rb:38:in `require'
from bin/importmap:4:in `<main>'
The reason importmap-rails makes an API request when unpinning packages, is so that it can tell if there are any dependencies it needs to remove at the same time.
It seems like POSTing https://api.jspm.io/generate
with the body
{
"install": [ "uikit-icons" ],
"flattenScope": true,
"env": [ "module" ]
}
just freezes. @guybedford would you have any idea what is causing this? Looking at the dependencies on NPM, there are less than 10 dependencies/subdependencies.
@Caleb-T-Owens thanks for the ping, I'll look into it when I can, may not have time this weekend so might need to defer to next.
@Caleb-T-Owens this package is now generating, although the generated import map is just an empty module because the package wasn't configured for a modular build with a valid "main"
or "exports"
CommonJS or ECMAScript module to execute.
For packages that aren't working like this, there is also the JSPM overrides repo which can be used to override the package.json configurations for packages that don't define their entry points correctly although this is very much a last resort when there are no other options - https://github.com/jspm/overrides.