title: Rails Active Storage KeyError: Missing configuration for the Active Storage service
body: <p><strong>UPDATE:</strong></p>
  <p><strong><strong>If I run the same action twice in the console, it fails the first time and WORKS the second time!</strong></strong></p>
  <p>This is happening to us on an upgrade to Rails 7.0.3 from 5.2</p>
  <p>Everything was working before and I know the YAML files are correct.</p>
  <p>Any active storage operation gives us:</p>
  <pre><code>KeyError: Missing configuration for the  Active Storage service. Configurations available for the local, test, amazon, and amazonDemo services.
  </code></pre>
  <p>storage.yml:</p>
  <pre><code>local:
    service: Disk
    root: &lt;%= Rails.root.join(&quot;storage&quot;) %&gt;
   
  test:
    service: Disk
    root: &lt;%= Rails.root.join(&quot;tmp/storage&quot;) %&gt;
  </code></pre>
  <p>In test.rb:</p>
  <pre><code>config.active_storage.service = :test
  </code></pre>
  <p>(We set those correctly in all of our environments..like I said, it was working before the upgrade)</p>
  <p>The thing that is interesting to me is the double space in the error message. It appears that the active storage service is not truly being set. I've looked at the Edge Guides and in every tutorial I can find. It doesn't feel like any other configurations should be necessary. I'm officially stumped.</p>
  <p>Ruby: 2.7.6
  Rails 7.0.3</p>
  <p>I did find one similar issue here:</p>
  <p><a href="https://github.com/rails/rails/issues/43145" rel="nofollow noreferrer">https://github.com/rails/rails/issues/43145</a></p>