I’m working on a Rails app that is set up to use Importmap for JavaScript asset management. However, in production (with Azure PostgreSQL as the database), I’m encountering an issue where the app tries to load Webpacker assets, such as /assets/channels/consumer.js
, even though Webpacker is no longer being used.
The strange part is that I have another production version hosted on Azure, which uses SQLite3 as the database, and this one works perfectly. The issue only happens when using Azure PostgreSQL as the database.
Here are a few things to note:
- Rails Version: Rails 7.1.3.4
- JS Handling: Using Importmap, not Webpacker.
- Error: ActionController::RoutingError for Webpacker assets (e.g.,
/assets/channels/consumer.js
). - Environment: Works fine with SQLite3 in development, and in another production version using SQLite3. The issue only happens with Azure PostgreSQL in production.
I’ve checked my asset pipeline setup and made sure javascript_importmap_tags
is correctly used in the layout, but the app still tries to load Webpacker assets when running on PostgreSQL.
What I’ve Tried:
- Cleared old assets using
assets:clobber
and recompiled usingassets:precompile
. - Checked for leftover Webpacker configuration (nothing found).
- Verified the use of
javascript_importmap_tags
in the layout. - Everything works perfectly in development with SQLite3 and in another Azure production version with SQLite3, but breaks in the production environment using Azure PostgreSQL.
Has anyone experienced something similar, or does anyone have insights into why switching the database from SQLite3 to PostgreSQL could affect how assets are loaded?
Thanks in advance!