Closed as not planned
Closed as not planned
Description
Steps to reproduce
- Add a
before_action
like the following to a controller:
http_basic_authenticate_with name: "admin", password: Rails.application.credentials.dig(:http_auth, :password)
- Attempt to build with the default Dockerfile (which contains
RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile
), and you receive the error:
19 [build 6/6] RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile
#19 0.844 bin/rails aborted!
#19 0.844 ArgumentError: Expected password: to be a String, got NilClass (ArgumentError)
#19 0.844
#19 0.844 raise ArgumentError, "Expected password: to be a String, got #{password.class}" unless password.is_a?(Str
ing)
#19 0.844 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
#19 0.844 /rails/app/controllers/http_auth_controller.rb:3:in `<class:HttpAuthController>'
#19 0.844 /rails/app/controllers/http_auth_controller.rb:1:in `<main>'
#19 0.844 /rails/config/environment.rb:5:in `<main>'
#19 0.844 Tasks: TOP => environment
#19 0.844 (See full trace by running task with --trace)
#19 ERROR: process "/bin/sh -c SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile" did not complete successfully: exit code:
1
Expected behavior
As far as I know precompiling assets need not depend on anything in the credentials, so ideally it shouldn’t even try (or the error could be silently ignored).
Actual behavior
The above error is raised, the build fails.
System configuration
Rails version: 7.1.3.2
Ruby version: 3.3.1
Metadata
Metadata
Assignees
Labels
No labels