Cannot load such file -- aws-sdk-sts/customizations


#1

I just re-deployed my Jets app and started getting this error in Jets.boot in all of my functions. Nothing really changed in my code or dependencies. I tried doing a bundle update, some gems updated but it didn’t help the problem. Any ideas why this would suddenly appear?

 "errorMessage": "cannot load such file -- /opt/ruby/gems/2.5.0/gems/aws-sdk-core-3.68.1/lib/aws-sdk-sts/customizations",
  "errorType": "Init<LoadError>",
  "stackTrace": [
"/opt/ruby/gems/2.5.0/gems/aws-sdk-core-3.68.1/lib/aws-sdk-sts.rb:14:in `require_relative'",
    "/opt/ruby/gems/2.5.0/gems/aws-sdk-core-3.68.1/lib/aws-sdk-sts.rb:14:in `<top (required)>'",
    "/opt/ruby/gems/2.5.0/gems/zeitwerk-2.2.0/lib/zeitwerk/kernel.rb:23:in `require'",
    "/opt/ruby/gems/2.5.0/gems/zeitwerk-2.2.0/lib/zeitwerk/kernel.rb:23:in `require'",
    "/opt/ruby/gems/2.5.0/gems/jets-2.3.1/lib/jets/core_ext/kernel.rb:11:in `require'",
 "/opt/ruby/gems/2.5.0/gems/activesupport-6.0.0/lib/active_support/dependencies.rb:325:in `block in require'",
    "/opt/ruby/gems/2.5.0/gems/activesupport-6.0.0/lib/active_support/dependencies.rb:291:in `load_dependency'",
    "/opt/ruby/gems/2.5.0/gems/activesupport-6.0.0/lib/active_support/dependencies.rb:325:in `require'",
    "/opt/ruby/gems/2.5.0/gems/aws-sdk-apigateway-1.35.0/lib/aws-sdk-apigateway.rb:8:in `<top (required)>'",
    "/opt/ruby/gems/2.5.0/gems/zeitwerk-2.2.0/lib/zeitwerk/kernel.rb:23:in `require'",
    "/opt/ruby/gems/2.5.0/gems/zeitwerk-2.2.0/lib/zeitwerk/kernel.rb:23:in `require'",
    "/opt/ruby/gems/2.5.0/gems/jets-2.3.1/lib/jets/core_ext/kernel.rb:11:in `require'",
    "/opt/ruby/gems/2.5.0/gems/activesupport-6.0.0/lib/active_support/dependencies.rb:325:in `block in require'",
    "/opt/ruby/gems/2.5.0/gems/activesupport-6.0.0/lib/active_support/dependencies.rb:291:in `load_dependency'",
    "/opt/ruby/gems/2.5.0/gems/activesupport-6.0.0/lib/active_support/dependencies.rb:325:in `require'",
    "/opt/ruby/gems/2.5.0/gems/jets-2.3.1/lib/jets/aws_services.rb:1:in `<top (required)>'",
    "/opt/ruby/gems/2.5.0/gems/zeitwerk-2.2.0/lib/zeitwerk/kernel.rb:16:in `require'",
    "/opt/ruby/gems/2.5.0/gems/zeitwerk-2.2.0/lib/zeitwerk/kernel.rb:16:in `require'",
    "/opt/ruby/gems/2.5.0/gems/jets-2.3.1/lib/jets/core_ext/kernel.rb:11:in `require'",
    "/opt/ruby/gems/2.5.0/gems/activesupport-6.0.0/lib/active_support/dependencies.rb:325:in `block in require'",
    "/opt/ruby/gems/2.5.0/gems/activesupport-6.0.0/lib/active_support/dependencies.rb:291:in `load_dependency'",
    "/opt/ruby/gems/2.5.0/gems/activesupport-6.0.0/lib/active_support/dependencies.rb:325:in `require'",
    "/opt/ruby/gems/2.5.0/gems/jets-2.3.1/lib/jets/overrides/rails/asset_tag_helper.rb:5:in `<module:AssetTagHelper>'",
    "/opt/ruby/gems/2.5.0/gems/jets-2.3.1/lib/jets/overrides/rails/asset_tag_helper.rb:2:in `<top (required)>'",
    "/opt/ruby/gems/2.5.0/gems/zeitwerk-2.2.0/lib/zeitwerk/kernel.rb:23:in `require'",
    "/opt/ruby/gems/2.5.0/gems/zeitwerk-2.2.0/lib/zeitwerk/kernel.rb:23:in `require'",
    "/opt/ruby/gems/2.5.0/gems/jets-2.3.1/lib/jets/core_ext/kernel.rb:11:in `require'",
    "/opt/ruby/gems/2.5.0/gems/activesupport-6.0.0/lib/active_support/dependencies.rb:325:in `block in require'",
    "/opt/ruby/gems/2.5.0/gems/activesupport-6.0.0/lib/active_support/dependencies.rb:291:in `load_dependency'",
    "/opt/ruby/gems/2.5.0/gems/activesupport-6.0.0/lib/active_support/dependencies.rb:325:in `require'",
    "/opt/ruby/gems/2.5.0/gems/jets-2.3.1/lib/jets/overrides/rails.rb:4:in `<top (required)>'",
    "/opt/ruby/gems/2.5.0/gems/zeitwerk-2.2.0/lib/zeitwerk/kernel.rb:23:in `require'",
    "/opt/ruby/gems/2.5.0/gems/zeitwerk-2.2.0/lib/zeitwerk/kernel.rb:23:in `require'",
    "/opt/ruby/gems/2.5.0/gems/jets-2.3.1/lib/jets/core_ext/kernel.rb:11:in `require'",
    "/opt/ruby/gems/2.5.0/gems/activesupport-6.0.0/lib/active_support/dependencies.rb:325:in `block in require'",
    "/opt/ruby/gems/2.5.0/gems/activesupport-6.0.0/lib/active_support/dependencies.rb:291:in `load_dependency'",
    "/opt/ruby/gems/2.5.0/gems/activesupport-6.0.0/lib/active_support/dependencies.rb:325:in `require'",
    "/opt/ruby/gems/2.5.0/gems/jets-2.3.1/lib/jets/controller/rendering/rack_renderer.rb:207:in `setup!'",
    "/opt/ruby/gems/2.5.0/gems/jets-2.3.1/lib/jets/application.rb:42:in `finish!'",
    "/opt/ruby/gems/2.5.0/gems/jets-2.3.1/lib/jets/booter.rb:24:in `boot!'",
    "/opt/ruby/gems/2.5.0/gems/jets-2.3.1/lib/jets/core.rb:18:in `boot'",

#2

Interestingly, the customizations.rb file that it’s referencing is an empty file. I wonder if something changed along the deploy process that skips empty files?


#3

Checked my local /tmp/jets folder and the customizations.rb is also empty, so don’t believe that is it.

$ cd /tmp/jets/demo/cache/vendor/gems/ruby/2.5.0/gems/aws-sdk-core-3.68.1
$ cat -n lib/aws-sdk-sts.rb  | grep 14
    14  require_relative 'aws-sdk-sts/customizations'
$ find . -name customizations.rb | xargs wc -l                                                                                                                    
0 ./lib/aws-sdk-sts/customizations.rb
$

The file is actually missing and not being packaged up.

Wondering if this may have caused the issue: https://github.com/tongueroo/jets/pull/387

Before jets would ignore all ~/.bundle/config settings. Unfortunately, this would prevent folks from using gems that have private resources. They would use:

bundle config gems.myprivatesource.com user:pass

to configure ~/.bundle/config and allow access to private sources that way.

Wondering if there’s a setting in ~/.bundle/config that could be affecting it. If this is the case, may go back to the BUNDLE_IGNORE_CONFIG=1 flag and adding another flag to explicitly not use it. Unsure here.


#4

Good thought, but I don’t think that change had anything to do with it. The problem occurred before I did a bundle update and got Jets 2.3.1.

Indeed, the customizations.rb file was missing from where it should have been in /tmp/jets/myapp/cache/vendor/gems. I just nuked the /tmp/jets/myapp/cache and re-deployed and that fixed it!

I wonder if some optimization process on my Mac cleaned up that 0-byte file? Scary.
Thanks again for quickly pointing me in the right direction. You’re awesome, @tung.


#5

That is scary. If that’s happening. Wonder if the Jets.build_root should be moved to ~/.jets/tmp and be periodically cleared.


#6

I have seeing similar problems twice, what i ended up doing is cleaning the build folder by running:

jets clean:build

i have incorporated that extra step before deploying and haven’t had this problem anymore, i do two to three deployments weekly to my production project.

hope that helps.


#7

That helps. Will move the build_root to ~/.jets/tmp