Webpacker can't find application in /app/public/packs-test/manifest.json

Hi, I am using Auto DevOps for my Rails 6 app. During GitLab.com’s CI/CD test stage I get this error:

ActionView::Template::Error: Webpacker can't find application in /app/public/packs-test/manifest.json. Possible causes:
1. You want to set webpacker.yml value of compile to true for your environment
   unless you are using the `webpack -w` or the webpack-dev-server.
2. webpack has not yet re-run to reflect updates.
3. You have misconfigured Webpacker's config/webpacker.yml file.
4. Your webpack configuration is not creating a manifest.
Your manifest contains:

    test/controllers/home_controller_test.rb:5:in `block in <class:HomeControllerTest>'

rails test test/controllers/home_controller_test.rb:4

I have tried a few things:

  1. Running “bin/rails test” locally
    No error.

  2. Running “bin/rails test” in local “herokuish:latest” docker image
    No error.

  3. Running “gitlab-runner exec docker test” locally with Auto Devops’ Test.gitlab-ci.yml template file
    App thinks it is running in production environment and complaining about missing “secret-key-base”. After setting RAILS_ENV=test, I get same error as above.

Is there anything else I can try to debug? Thanks in advance.

The ruby buildpack does not compile webpack by default. To avoid changes in autodevops template itself, I end up enforcing compilation in rails_helper by adding before suite command:

RSpec.configure do |config|
  config.before(:suite) do
    # Install yarn
    system("cd #{Rails.root.to_s} && yarn install --no-progress --no-audit --no-optional")

    # Run bin/webpack
    path = Rails.root.join('bin', 'webpack')

    # Ensure manifest exists
    Timeout.timeout(10) do
      loop until Webpacker.config.public_manifest_path.exist?

This is a workaround but its not efficient since it runs webpack everytime you do rspec spec. You might want to improve it with conditional ENV variables.

I’ve got the same problem. Seems like Auto DevOps is still not Rails 6 compatible.
The workaround won’t work for me as I’m not using rspec.