Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.6k
/asset/bundle/X cannot be found on Production but works fine on Staging#60912
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
I got the following problem in Sonata Admin. My javascript and Style files cannot be loaded on production. But everything seems to be the same on staging and there it works just fine. The files on the sever should exactly match because i just deployed the current staging state to prod. Is there a way for me to debug this? My bundles
And my dependencies "php":">=8.2","ext-ctype":"*","ext-dom":"*","ext-iconv":"*","api-platform/core":"^4.1","aws/aws-sdk-php":"^3.307","beberlei/doctrineextensions":"^1.5","cocur/slugify":"^4.5","doctrine/annotations":"^2.0","doctrine/dbal":"^4.1.1","doctrine/doctrine-bundle":"^2.12","doctrine/doctrine-migrations-bundle":"^3.3","doctrine/orm":"^3.1","dragonmantank/cron-expression":"^3.4","endroid/qr-code-bundle":"^6.0","friendsofsymfony/ckeditor-bundle":"^2.5","gaufrette/extras":"^0.1.0","gedmo/doctrine-extensions":"^3.14","geocoder-php/bing-maps-provider":"*","geocoder-php/chain-provider":"*","geocoder-php/google-maps-provider":"*","gumlet/php-image-resize":"^2.0","guzzlehttp/guzzle":"^7.0","hautelook/alice-bundle":"^2.14","icecave/parity":"*","imagine/imagine":"^1.3","incenteev/composer-parameter-handler":"^2.1.x-dev","knplabs/gaufrette":"0.12.1 as 0.11.1","knplabs/knp-gaufrette-bundle":"^0.9.0","knplabs/knp-snappy-bundle":"^1.10","lexik/jwt-authentication-bundle":"*","nelmio/cors-bundle":"^2.4","nelmio/security-bundle":"^3.3","nyholm/psr7":"*","phpdocumentor/reflection-docblock":"^5.4","phpstan/phpdoc-parser":"^1.29","sentry/sentry-symfony":"^5.0","sonata-project/admin-bundle":"^4.30","sonata-project/block-bundle":"^5.1","sonata-project/doctrine-orm-admin-bundle":"^4.17","sonata-project/form-extensions":"^2.4","symfony/asset":"7.2.*","symfony/console":"7.2.*","symfony/expression-language":"7.2.*","symfony/flex":"^2","symfony/framework-bundle":"7.2.*","symfony/http-client":"7.2.*","symfony/mailer":"7.2.*","symfony/monolog-bundle":"^3.10","symfony/property-access":"7.2.*","symfony/property-info":"7.2.*","symfony/runtime":"7.2.*","symfony/security-bundle":"7.2.*","symfony/serializer":"7.2.*","symfony/stimulus-bundle":"^2.23","symfony/translation":"7.2.*","symfony/twig-bundle":"7.2.*","symfony/uid":"7.2.*","symfony/ux-turbo":"^2.23","symfony/validator":"7.2.*","symfony/webpack-encore-bundle":"^2.2","symfony/yaml":"7.2.*","symfonycasts/tailwind-bundle":"^0.10.0","thiagoalessio/tesseract_ocr":"^2.13","tomsgu/pdf-merger-bundle":"^0.5.1","twig/cssinliner-extra":"^3.10","twig/extra-bundle":"^3.10","twig/twig":"^3.20","vich/uploader-bundle":"^2.3","willdurand/geocoder-bundle":"*","symfony/browser-kit":"7.2.*","symfony/css-selector":"7.2.*","symfony/debug-bundle":"7.2.*","symfony/dotenv":"7.2.*","symfony/maker-bundle":"*","symfony/var-dumper":"7.2.*","symfony/web-profiler-bundle":"7.2.*","testcontainers/testcontainers":"^0.2.0" And my webpack.config.js importEncorefrom'@symfony/webpack-encore';// Manually configure the runtime environment if not already configured yet by the "encore" command.// It's useful when you use tools that rely on webpack.config.js file.if(!Encore.isRuntimeEnvironmentConfigured()){Encore.configureRuntimeEnvironment(process.env.NODE_ENV||'dev');}Encore// directory where compiled assets will be stored.setOutputPath('public/build/')// public path used by the web server to access the output path.setPublicPath('/build')// only needed for CDN's or subdirectory deploy//.setManifestKeyPrefix('build/')/* * ENTRY CONFIG * * Each entry will result in one JavaScript file (e.g. app.js) * and one CSS file (e.g. app.css) if your JavaScript imports CSS. */.addEntry('app','./assets/app.js')// .addStyleEntry('tailwind', './assets/css/tailwind.css')// When enabled, Webpack "splits" your files into smaller pieces for greater optimization..splitEntryChunks()// will require an extra script tag for runtime.js// but, you probably want this, unless you're building a single-page app// .enableSingleRuntimeChunk().disableSingleRuntimeChunk()/* * FEATURE CONFIG * * Enable & configure other features below. For a full * list of features, see: * https://symfony.com/doc/current/frontend.html#adding-more-features */.cleanupOutputBeforeBuild()// Displays build status system notifications to the user.enableBuildNotifications().enableSourceMaps(!Encore.isProduction())// enables hashed filenames (e.g. app.abc123.css)// IS THIS MY PROBLEM? But why does it not work on prod? Both systems seem to have versioned urls. I already commented it, set it to false but the bundle files still got the hash at the end..enableVersioning(Encore.isProduction())// configure Babel// .configureBabel((config) => {// config.plugins.push('@babel/plugin-proposal-class-properties');// })// enables and configure@babel/preset-env polyfills.configureBabelPresetEnv((config)=>{config.useBuiltIns='usage';config.corejs=3;})// enables Sass/SCSS support//.enableSassLoader().enablePostCssLoader()// uncomment if you use TypeScript//.enableTypeScriptLoader()// uncomment if you use React//.enableReactPreset()// uncomment to get integrity="..." attributes on your script & link tags// requires WebpackEncoreBundle 1.4 or higher//.enableIntegrityHashes(Encore.isProduction())// uncomment if you're having problems with a jQuery plugin//.autoProvidejQuery();exportdefaultEncore.getWebpackConfig();
Even without any version format strategy or json manifest the bundle files still got the hashed url |
BetaWas this translation helpful?Give feedback.
All reactions
Replies: 1 comment 2 replies
-
I found "a solution". I ran |
BetaWas this translation helpful?Give feedback.
All reactions
-
Talking about Which Symfony config are you using on your staging server ? AssetMapper has 2 mode:
|
BetaWas this translation helpful?Give feedback.
All reactions
-
My project uses the symfony/asset package. But then i needed tailwind and googled how to use tailwind with symfony and twig. I used this guide to install ithttps://tailwindcss.com/docs/installation/framework-guides/symfony I guess now i have a mixed setup? Would sonata admin + tailwind work via only webpack encore as suggested in the guide? |
BetaWas this translation helpful?Give feedback.