-
Type:
Bug/Issue
-
Resolution: Unresolved
-
Priority:
Moderate
-
None
-
Not measure related
-
Not measure related
-
Not measure related
-
Not measure related
-
7.4.2
After upgrading to Cypress 7.4.2 using the upgrade script (located here), the application fails to start with a 502 Bad Gateway error from nginx. The root cause is a missing `SECRET_KEY_BASE` environment variable required by Rails 8.
The environment is Ubuntu 22.04, originally installed quite some time ago, I believe, using the chef instructions from ([here|https://github.com/projectcypress/cypress/wiki/Cypress-7-Install-Instructions).]
The service logs (`journalctl -u cypress-web-1.service`) show:
Unable to load application: ArgumentError: Missing secret_key_base for 'production' environment, set this string with bin/rails credentials:edit
Rails 8 seems to require `SECRET_KEY_BASE` to be set for production. The upgrade script does not generate this, nor did the previous ones apparently. Previous versions of cypress seemed to use Rails 6.0.4, which might not have had as strict of a requirement for this?
I resolved it by generating, and setting, a random key:
SECRET=$(hexdump -n 64 -e '16/1 "%02x" ""' /dev/urandom)
sudo cypress config:set SECRET_KEY_BASE=$SECRET
And restarting the service:
sudo systemctl restart cypress-web-1.service
Suggested fix: The upgrade script should check for it, create a new one or alert the user, or maybe add a note in the upgrade wiki.