AWS Comprehend is in its early stages. The dev world is slowly seeing its potential. It's a struggle getting it set up with your Rails environment. The following resolved my problems. I hope it solves yours, too!
# app/models/clients/aws_comprehend.rb
class Clients::AwsComprehend
def self.call
Aws::Comprehend::Client.new(
region: ENV.fetch("AWS_REGION"),
access_key_id: ENV.fetch("AWS_ACCESS_KEY"),
secret_access_key: ENV.fetch("AWS_SECRET_ACCESS_KEY")
)
end
end
> Clients::AwsComprehend.()
=> NameError (uninitialized constant Aws::Comprehend::Client)
cannot load such file -- aws-sdk-core/plugins/http_checksum.rb
LoadError: cannot load such file -- aws-sdk-core/plugins/http_checksum.rb
Solution
After digging online, this Github issue comment did the trick: https://github.com/aws/aws-sdk-ruby/issues/1872#issuecomment-461634704
> bundle update aws-sdk-s3
> Clients::AwsComprehend.()
=> KeyError (key not found: "AWS_ACCESS_KEY")
Obviously this is returns a different problem. However, updating aws-sdk-core
to the latest will get you past the load error.
Top comments (0)