Error “uninitialized constant AWS (NameError)”

前端 未结 7 1889
梦毁少年i
梦毁少年i 2021-02-06 21:39

It is saying AWS is uninitialized. I am usign the aws-sdk-core gem.

I tried using the aws-sdk gem instead, and the problem was still there.

This is the initializ

7条回答
  •  我寻月下人不归
    2021-02-06 22:18

    You might getting this error, because you didn't define the correct aws sdk version in your Gemfile. This can happen while re-bundling old apps with version 1 or 2 installed.

    Make sure which version you want to install:

    aws-sdk version 3

    gem 'aws-sdk', '~> 3'
    
    # call sdk    
    Aws.
    

    aws-sdk version 2

    gem 'aws-sdk', '~> 2'
    
    # call sdk    
    Aws.
    

    aws-sdk version 1

    # version constraint
    gem 'aws-sdk', '< 2'
    
    # or 
    
    # use the v1 gem
    gem 'aws-sdk-v1'
    
    # call sdk    
    AWS.
    

    v1 is scoped under AWS and v2 and v3 scoped under Aws => That allows you to run v1 and v2 side by side.

提交回复
热议问题