Skip to content

importmap audit panics when npm returns an HTTP failure code #300

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
tmeire opened this issue Jun 12, 2025 · 0 comments · May be fixed by #301
Open

importmap audit panics when npm returns an HTTP failure code #300

tmeire opened this issue Jun 12, 2025 · 0 comments · May be fixed by #301

Comments

@tmeire
Copy link

tmeire commented Jun 12, 2025

During a widespread outage today, I tried to run an importmap audit, but the command panicked with a rather unclear message because it was unable to download the list of vulnerabilities from the NPM registry.

    ▶ bin/importmap audit
    /opt/homebrew/lib/ruby/gems/3.4.0/gems/importmap-rails-2.1.0/lib/importmap/npm.rb:38:in 'block in Importmap::Npm#vulnerable_packages': undefined method 'map' for an instance of String (NoMethodError)
    
          vulnerabilities.map do |vulnerability|
                         ^^^^
    Did you mean?  tap
    	from /opt/homebrew/lib/ruby/gems/3.4.0/gems/importmap-rails-2.1.0/lib/importmap/npm.rb:37:in 'Hash#each'
    	from /opt/homebrew/lib/ruby/gems/3.4.0/gems/importmap-rails-2.1.0/lib/importmap/npm.rb:37:in 'Enumerable#flat_map'
    	from /opt/homebrew/lib/ruby/gems/3.4.0/gems/importmap-rails-2.1.0/lib/importmap/npm.rb:37:in 'Importmap::Npm#vulnerable_packages'
    	from /opt/homebrew/lib/ruby/gems/3.4.0/gems/importmap-rails-2.1.0/lib/importmap/commands.rb:75:in 'Importmap::Commands#audit'
    	from /opt/homebrew/lib/ruby/gems/3.4.0/gems/thor-1.3.2/lib/thor/command.rb:28:in 'Thor::Command#run'
    	from /opt/homebrew/lib/ruby/gems/3.4.0/gems/thor-1.3.2/lib/thor/invocation.rb:127:in 'Thor::Invocation#invoke_command'
    	from /opt/homebrew/lib/ruby/gems/3.4.0/gems/thor-1.3.2/lib/thor.rb:538:in 'Thor.dispatch'
    	from /opt/homebrew/lib/ruby/gems/3.4.0/gems/thor-1.3.2/lib/thor/base.rb:584:in 'Thor::Base::ClassMethods#start'
    	from /opt/homebrew/lib/ruby/gems/3.4.0/gems/importmap-rails-2.1.0/lib/importmap/commands.rb:159:in '<main>'
    	from /opt/homebrew/Cellar/ruby/3.4.2/lib/ruby/3.4.0/bundled_gems.rb:82:in 'Kernel.require'
    	from /opt/homebrew/Cellar/ruby/3.4.2/lib/ruby/3.4.0/bundled_gems.rb:82:in 'block (2 levels) in Kernel#replace_require'
    	from /opt/homebrew/lib/ruby/gems/3.4.0/gems/bootsnap-1.18.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in 'Kernel#require'
    	from /opt/homebrew/lib/ruby/gems/3.4.0/gems/zeitwerk-2.7.3/lib/zeitwerk/core_ext/kernel.rb:34:in 'Kernel#require'
    	from bin/importmap:4:in '<main>'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant