[Ruby On Rails] About RubyAws :: Sigv4 :: Errors :: MissingCredentialsError

Error background

After installing AWS, I uploaded an image from the application under development in the local environment and tried to check if the actually saved thing was saved in S3, but I got an error like this time.

Meaning of error statement

スクリーンショット 2020-11-03 21.00.21.png

"Cannot read. The credentials are missing, so please use one of the following to give the credentials."

It will be like that.

:access_key_id :secret_access_key :credentials

....

This means that they may have picked up those credentials correctly and not read them.

What I confirmed

In order to be able to save to S3, I prepared a bucket so that data can be stored in S3, and set the region and check box appropriately. The bucket policy also definitely entered the user's ARN and bucket name.

Then, I assigned the environment variables in the terminal and confirmed that the description of conflict / environments / production.rb and the description of config / storage.yml were done correctly.

confing/environments/production.rb


config.active_storage.service = :amazon

confing/environment/development.rb


config.active_storage.service = :amazon

config/storage.yml


amazon:
  service: S3
  access_key_id: <%= ENV['AWS_ACCESS_KEY_ID'] %>
  secret_access_key: <%= ENV['AWS_SECRET_ACCESS_KEY'] %>
  region: ap-northeast-1
  bucket:Bucket name

hypothesis

Input in the terminal is not done correctly

Work based on hypothesis

Check if it works properly with vim ~ / .zshrc command or source ~ / .zshrc command

result

The cause was not running source ~ / .zshrc.

What is source ~ / .zshrc in the first place?

A command to execute after entering a key in vim ~ / .zshrc and saving. A command that allows you to use the variables added as environment variables after reloading .zshrc.

If you don't do that, you'll get an error saying that you can't upload the image. I would like to remember to do what I made a mistake from the next time.

Recommended Posts

[Ruby On Rails] About RubyAws :: Sigv4 :: Errors :: MissingCredentialsError
[Ruby on Rails] about has_secure_password
[Ruby on Rails] About bundler (for beginners)
[Ruby on Rails] About Active Record callbacks
[Ruby on Rails] Japanese notation of errors
Ruby on Rails Elementary
Ruby on Rails basics
Ruby On Rails Association
[Environment construction Mac] Ruby on Rails (+ Webpacker handles errors)
Portfolio creation Ruby on Rails
Ruby on rails learning record -2020.10.04
[Ruby on Rails] Debug (binding.pry)
Ruby on rails learning record -2020.10.05
Ruby on rails learning record -2020.10.09
Ruby on Rails config configuration
Ruby on Rails basic learning ①
Ruby on rails learning record-2020.10.07 ②
Commentary on partial! --Ruby on Rails
Ruby on rails learning record-2020.10.07 ①
Cancel Ruby on Rails migration
Ruby on rails learning record -2020.10.06
Ruby on Rails validation summary
Ruby on Rails Basic Memorandum
A note about the seed function of Ruby on Rails
[Note] About the Fizz_Buzz problem (How Ruby on Rails works)
Ruby on Rails Overview (Beginner Summary)
[Ruby on Rails] Read try (: [],: key)
Installing Ruby + Rails on Ubuntu 18.04 (rbenv)
[Ruby on Rails] Introduced paging function
Basic knowledge of Ruby on Rails
Progate Ruby on Rails5 Looking Back
How to use Ruby on Rails
[Ruby on Rails] Add / Remove Columns
Ruby on Rails Japanese-English support i18n
(Ruby on Rails6) "Erase" posted content
[Ruby on Rails] CSV output function
Ruby on Rails 6.0 environment construction memo
[Ruby on Rails] What is Bcrypt?
[Ruby on Rails] Confirmation page creation
Ruby On Rails devise routing conflict
[Ruby on Rails] Comment function implementation
[Ruby on Rails] DM, chat function
[Ruby on Rails] Convenient helper method
[Ruby on Rails] Stop "looping until ..."
[Ruby on Rails] Introduction of initial data
[Ruby on Rails] Search function (not selected)
[Rails] Addition of Ruby On Rails comment function
[Ruby on Rails] Creating an inquiry form
Ruby on Rails6 Practical Guide cp13 ~ cp15 [Memo]
[Ruby on Rails] View test with RSpec
[Ruby on Rails] Code check using Rubocop-airbnb
[Ruby on Rails] 1 model CRUD (Routing Main)
Ruby on Rails installation method [Mac edition]
About Rails 6
[Ruby on Rails] model, controller terminal command
Let's summarize "MVC" of Ruby on Rails
Ruby on Rails model creation / deletion command
part of the syntax of ruby ​​on rails
Ruby on Rails6 Practical Guide cp7 ~ cp9 [Memo]
Ruby on Rails in Visual Studio Codespaces
[Ruby on Rails] NoMethodError: undefined method `t'for # <ActiveRecord :: Migration: 〇〇〇〇> Dealing with errors