Missing `secret_key_base`

=> ERROR [build 9/9] RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile 2.2s

[build 9/9] RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile:
#19 2.174 rails aborted!
#19 2.174 ArgumentError: Missing secret_key_base for ‘production’ environment, set this string with bin/rails credentials:edit

RAILS_ENV=production EDITOR=nova rails credentials:edit and have this in the file


bing_api: esrdftgyhuij

aws:
 service: S3
 access_key_id: ESXDRCFTVGYHBJ
 secret_access_key: drtfygvubh
 region: us-west-1
 bucket: aname

(all keys except service and region not as shown). The same file opens with EDITOR=nova rails credentials:edit so not sure what the " ‘production’ environment" is referring to.

``flyctl deploy --build-arg SECRET_KET_BASE=placeholder same error per another post made no difference. Got error then and with fly deploy

I didn’t see anything in the " Your topic is similar to…" that helped

I also tried using a different fly.toml from another app and got the same error.

Rails 7.0.4.3. ruby 3.2.0, esbuild.

It looks like you picked up a Dockerfile that was intended for Rails 7.1 and are trying to run it with a Rails 7.0 application.

The easiest fix is to generate a new Dockerfile tailored to your needs using:

bin/rails generate dockerfile

In this specific case, the correct line would read RUN SECRET_KEY_BASE=DUMMY instead, but there may be other changes needed to get you up and running, so generating a new dockerfile (and accepting the changes) is best.

Oops, splat (me tripping). I had changed back to 7.0 to sort something out. Went back to 7.1 and it works.

Now I need to find out why application.scss is fussy. But I just toggle it to deploy. But I don’t remember and it fails every time. Not a fly.io issue.

// localhost
// @import ‘bootstrap/scss/bootstrap’;
// @import ‘bootstrap-icons/font/bootstrap-icons’;
// @import ‘ol-layerswitcher/dist/ol-layerswitcher’;

// fly deploy. Launches on localhost, but no bootstrap formatting
@import ‘bootstrap/scss/bootstrap.css’;
@import ‘bootstrap-icons/font/bootstrap-icons.css’;
@import ‘ol-layerswitcher/dist/ol-layerswitcher.css’;

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.