1

I am trying to deploy a Rails application to Google App Engine Flex.

app.json:

runtime: ruby
env: flex
entrypoint: bundle exec rails server -p 8080

Gemfile:

gem 'bootsnap', '>= 1.4.4', require: false
gem 'jbuilder', '~> 2.11'
gem 'pg', '~> 1.3'
gem 'puma', '~> 5.6'
gem 'rails', '~> 7.0.2'
gem 'redis', '~> 4.0'
gem 'sass-rails', '>= 6'
gem 'turbolinks', '~> 5'
gem 'tzinfo-data', platforms: %i[mingw mswin x64_mingw jruby]
gem 'webpacker', '~> 5.0'
gem "appengine", "~> 0.6.0"

deploy output:

...
Step #1: Step 15/18 : RUN access_cloud_sql --lenient && bundle exec rake assets:precompile || true
Step #1:  ---> Running in 725718ed7002
Step #1: Started cloud_sql_proxy.
Step #1: fatal: Not a git repository (or any of the parent directories): .git
Step #1: I, [2022-03-30T22:17:20.368483 #52]  INFO -- : Writing /app/public/assets/application-04024382391bb910584145d8113cf35ef376b55d125bb4516cebeb14ce788597.css
Step #1: I, [2022-03-30T22:17:20.369454 #52]  INFO -- : Writing /app/public/assets/application-04024382391bb910584145d8113cf35ef376b55d125bb4516cebeb14ce788597.css.gz
Step #1: I, [2022-03-30T22:17:20.370448 #52]  INFO -- : Writing /app/public/assets/trix-6fd35bb8fae1d6a795115763ca265369b9750f73a1c6283a0b0ef4b6c2d550c8.css
Step #1: I, [2022-03-30T22:17:20.371103 #52]  INFO -- : Writing /app/public/assets/trix-6fd35bb8fae1d6a795115763ca265369b9750f73a1c6283a0b0ef4b6c2d550c8.css.gz
Step #1: Compiling...
Step #1: Compilation failed:
Step #1: yarn run v1.22.18
Step #1: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Step #1:
Step #1:
Step #1: error Command "webpack" not found.
Step #1:
...

When deployed viewing the site has the following errors in the Logs Explorer:

ActionView::Template::Error (Webpacker can't find application.js in /app/public/packs/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:
{
}
):
     7:     <%= csp_meta_tag %>
     8: 
     9:     <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
    10:     <%= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload' %>
    11:     <%= stylesheet_pack_tag 'application', 'data-turbolinks-track': 'reload' %>
    12:   </head>
    13: 
  
app/views/layouts/application.html.erb:10
1
  • Have you tried running the command rails webpacker:compile? Commented Mar 31, 2022 at 7:42

1 Answer 1

1

Adding this to my app.yaml fixed it for me:

runtime_config:
  build:
    - yarn install && bundle exec rails assets:precompile

From your github issue (thanks! ;)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.