Rails Solid Cache - missing secret key base

nazisagit
HOBBY

14 days ago

ArgumentError: Missing `secret_key_base` for 'production' environment, set this string with `bin/rails credentials:edit` (ArgumentError)
          raise ArgumentError, "Missing `secret_key_base` for '#{Rails.env}' environment, set this string with `bin/rails credentials:edit`"

I am deploying my rails 8 application. It is built using a Dockerfile. I have solid cache installed, during build time it is unable to find the secret_key_base. However, I ssh'd into the code base and I checked the production yaml and the secret key base is indeed there. I have also added the RAILS_MASTER_KEY variable to my environment and set it to the production key value. I suspect it may be due to my Dockerfile, however I cannot be sure.

Solved

4 Replies

14 days ago

Did you add ARG in your Dockerfile so it's available at the application layer?


Status changed to Awaiting User Response Railway 14 days ago


nazisagit
HOBBY

14 days ago

I did not actually. Is this how it needs to be set?

```

ARG RAILS_MASTER_KEY=$RAILS_MASTER_KEY
```


jake

Did you add ARG in your Dockerfile so it's available at the application layer?

nazisagit
HOBBY

14 days ago

I did not actually. Is this how it needs to be set?

```

ARG RAILS_MASTER_KEY=$RAILS_MASTER_KEY
```


nazisagit
HOBBY

14 days ago

Closing this thread as I don't need it anymore


Status changed to Solved nazisagit 14 days ago


Rails Solid Cache - missing secret key base - Railway Help Station