---
title: Debug Rails Deployments
url: "/docs/debug/rails/"
canonical_url: https://docs.blossom88.com/docs/debug/rails/
markdown_url: https://docs.blossom88.com/docs/debug/rails.md
summary: Common issues and solutions for deploying Ruby on Rails applications on Blossom
categories:
- debugging
- frameworks
- ruby
- rails
- troubleshooting
---

# Debug Rails Deployments

Open the failed deployment's **Activity** and **Environment logs**, then match
the error below. Fix the App setting and deploy again.

## Find The Fix

| Symptom | Check |
|---|---|
| `ActiveSupport::MessageEncryptor::InvalidMessage` | `RAILS_MASTER_KEY` must match the credentials file Rails loads |
| Session or secret-key errors | Keep `secret_key_base` stable in credentials or `SECRET_KEY_BASE` |
| `Blocked host` / HTTP 403 | Add the generated hostname and your domains to `config.hosts` |
| HTTPS redirect loop | Check proxy handling; use `config.assume_ssl = true` when TLS terminates before Rails |
| Missing CSS or JavaScript | Confirm assets compiled; enable Rails' public file server if Rails serves them |
| Missing tables | Run database preparation in the Release Phase |

## Credentials

For environment-specific production credentials, edit them locally:

    EDITOR="code --wait" bin/rails credentials:edit --environment=production

This creates the encrypted file and its key if needed. Commit
`config/credentials/production.yml.enc`; keep
`config/credentials/production.key` private. Set `RAILS_MASTER_KEY` to that key
in the Environment's variables. Apps using shared credentials instead use the
key for `config/credentials.yml.enc`. See
[Rails credentials](https://guides.rubyonrails.org/security.html#custom-credentials).

## Hosts, HTTPS And Assets

production.rb:

```ruby
config.hosts << "my-app.example.com"
config.force_ssl = true
# When your proxy terminates HTTPS before forwarding to Rails:
config.assume_ssl = true
config.public_file_server.enabled = ENV["RAILS_SERVE_STATIC_FILES"].present?
```

Add every hostname you serve. For Rails-served assets, set
`RAILS_SERVE_STATIC_FILES=true` and confirm your build compiles assets into
`public/assets`. A CDN can serve assets separately.

## Database Setup

Connect the [Database](/docs/databases/#connect-an-environment)
through an Environment Link so Rails receives `DATABASE_URL`. If Solid Queue,
Cache or Cable uses separate databases, link those with the variable names
expected by your App.

Set the [Release Phase](/docs/apps/deploy-hooks/) to:

    bin/rails db:prepare

Rails prepares the database and applies migrations before the new Release
takes traffic. Run application-specific seed commands only when needed.

## What You Get

A Rails App with matching credentials, working hosts and assets, and database
preparation attached to its deployment. For platform failures, follow
[Troubleshooting](/docs/debug/) with the Activity ID.
