Closed mt-kelvintaywl closed 3 years ago
I am also curious why the ruby-next lib is needed if the codebase using anyway_config is >= 2.7 ?
anyway_config uses some Ruby 3 syntax.
Gem's lib is not in the $LOAD_PATH
Hm, that's interesting.
How do you load the anyway_config gem? Could you print the contents of the $LOAD_PATH?
Also, take a look at this question and the code snippet: https://stackoverflow.com/a/53698808
@palkan thank you for the quick response and suggestion.
Indeed, i examined the $LOAD_PATH
in our Ruby Lambda and oddly, the gems' paths in $LOAD_PATH
were with useless dots and slashes.
# examples
"/var/task/vendor/bundle/bundler/../ruby/2.7.0/gems/aws-sdk-core-3.72.0/lib",
"/var/task/vendor/bundle/bundler/../ruby/2.7.0/gems/jmespath-1.4.0/lib",
"/var/task/vendor/bundle/bundler/../ruby/2.7.0/gems/aws-sigv4-1.1.0/lib",
"/var/task/vendor/bundle/bundler/../ruby/2.7.0/gems/aws-partitions-1.230.0/lib",
"/var/task/vendor/bundle/bundler/../ruby/2.7.0/gems/aws-eventstream-1.0.3/lib",
"/var/task/vendor/bundle/bundler/../ruby/2.7.0/gems/ast-2.4.1/lib",
"/var/task/vendor/bundle/bundler/../ruby/2.7.0/gems/anyway_config-2.0.6/lib",
"/var/task/vendor/bundle/bundler/../ruby/2.7.0/gems/ruby-next-core-0.10.5/lib",
"/var/task/vendor/bundle/bundler/../ruby/2.7.0/gems/activesupport-6.0.3.2/lib",
for context, we use the Serverless framework to package & deploy our functions. We also use the
ruby-package
plugin for packaging dependencies. As a requirement of that plugin, we needed to use bundler in standalone mode. I wonder if that meant the load paths ended up as above? 🤔
I managed to have this worked around with another throwaway Lambda where:
cleaned = $LOAD_PATH.map { |path| Pathname.new(path).cleanpath }
$LOAD_PATH.unshift(*cleaned)
As such, this is indeed, not an issue on anyway_config
nor ruby-next
itself, so I will close this indeed 🙇
Thank you so much for your help as always! Really appreciate it!
Hi @palkan , sorry for the ping but I was wondering if you can point me to a right way to resolve this? 🙏 thank you so much!
What did you do?
I am using
anyway_config
gem as a dependency in an AWS Lambda function. For context, the Ruby runtime env for the Lambda is Ruby 2.7My Gemfile includes
I am not sure why when the Lambda is invoked, i am seeing error from Ruby-next from Anyway Config?
What did you expect to happen?
the function should have executed successfully without this error. Forgive me for being ignorant, but I am also curious why the
ruby-next
lib is needed if the codebase usinganyway_config
is >= 2.7 ?What actually happened?
Additional context
Environment
Ruby Version:
2.7.2
Framework Version (Rails, whatever):
-
Anyway Config Version:
2.0.6