[RAILS] [Docker environment] How to deal with ActiveSupport :: MessageEncryptor :: InvalidMessage

After deploying the portfolio to AWS, I got a title error during local development and it took a long time to resolve, so I will post a workaround as a memorandum.

Recreate credential.yml.enc

It is designed to open credential.yml.enc using master.key, but it is throwing an error because it cannot be opened. Therefore, it is necessary to recreate credential.yml.enc.

$ EDITOR=vim bin/rails credetials:edit

This command combines the encrypted file with master.key, edits it with the specified editor, and saves the result again encrypted. Also, if you don't have master.key, it will create a new one, and if you don't have credentials.yml.enc, it will create a new one. Therefore, delete the existing credential.yml.enc and solve it with the above command.

However, my local environment is on the Docker container, so a little special command is required. First, log in to the server and install vim.

On EC2 server


$ apt-get install -y vim

Local environment


$ docker-compose run -e EDITOR=vim web rails credentials:edit

Starting live_share_db_1 ... done
File encrypted and saved.

Now I don't throw any errors ^^

reference

https://qiita.com/at-946/items/8630ddd411d1e6a651c6 https://qiita.com/zenfumi/items/4a7cbab59f0f7ede0d6e

Recommended Posts

[Docker environment] How to deal with ActiveSupport :: MessageEncryptor :: InvalidMessage
How to build Rails 6 environment with Docker
[Rails] How to build an environment with Docker
How to build docker environment with Gradle for intelliJ
[Docker + Rails] How to deal with Rails server startup failure
How to start Camunda with Docker
How to build [TypeScript + Vue + Express + MySQL] environment with Docker ~ Express ~
How to build Rails, Postgres, ElasticSearch development environment with Docker
[Android] How to deal with dark themes
[Rails] How to use rails console with docker
How to build [TypeScript + Vue + Express + MySQL] environment with Docker ~ MySQL edition ~
How to install Pry after building Rails development environment with Docker
How to build Rails + Vue + MySQL environment with Docker [2020/09 latest version]
How to deal with Precompiling assets failed.
How to build [TypeScript + Vue + Express + MySQL] environment with Docker ~ Sequelize ~
How to run Blazor (C #) with Docker
How to execute with commands of normal development language in Docker development environment
How to build a Ruby on Rails development environment with Docker (Rails 6.x)
[Node.js express Docker] How to define Docker environment variables and load them with node.js
How to build a Ruby on Rails development environment with Docker (Rails 5.x)
How to give your image to someone with docker
How to use docker compose with NVIDIA Jetson
How to use nginx-ingress-controller with Docker for Mac
How to install Docker
[Laravel] How to deal with out of memory error when composer require [Docker]
How to build an environment of [TypeScript + Vue + Express + MySQL] with Docker ~ Vue edition ~
Diet program with preprocessor (how to deal with i-appli size)
How to deal with fatal: remote origin already exists.
How to deal with No template for interactive request
[Rails] How to deal with URL changes after render
How to delete untagged images in bulk with Docker
How to build Java development environment with VS Code
How to make Laravel faster with Docker for Mac
How to boot by environment with Spring Boot of Maven
Common problems with WSL and how to deal with them
[Rails] [Docker] Copy and paste is OK! How to build a Rails development environment with Docker
[Docker] How to update using a container on Heroku and how to deal with Migrate Error
How to deal with `Cannot connect to the Docker daemon at unix: /// var/run/docker.sock. Is the docker daemon running?`
How to quit Docker for Mac and build a Docker development environment with Ubuntu + Vagrant
How to deal with Selenium :: WebDriver :: Error :: UnknownError that occurs in Dokcer environment etc.
Pytorch execution environment with Docker
How to set Docker nginx
How to number (number) with html.erb
How to update with activerecord-import
[Docker] Rails 5.2 environment construction with docker
Build docker environment with WSL
React environment construction with Docker
How to deal with the error yaml.scanner.ScannerError: while scanning for the next token that appeared in Rails environment construction with Docker
How to set environment variables when using Payjp with Rails
How to get started with Gatsby (TypeScript) x Netlify x Docker
How to deal with the error ERROR: While executing gem ... (Gem :: FilePermissionError)
How to use mysql with M1 mac Docker preview version
Build a Node-RED environment with Docker to move and understand
How to deal with Bundler :: Dsl :: DSLError by rewriting gemfile
I tried to create a padrino development environment with Docker
[Docker context] ~ How to access docker in remote environment from VScode ~
How to deal with different versions of rbenv and Ruby
Rails + MySQL environment construction with Docker
Create a Vue3 environment with Docker!
Node.js environment construction with Docker Compose
[Rails / RSpec] How to deal with element has zero size error