Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Assets not loaded when running frontend alongside DCR locally #10538

Closed
SiAdcock opened this issue Feb 8, 2024 · 2 comments
Closed

[Bug]: Assets not loaded when running frontend alongside DCR locally #10538

SiAdcock opened this issue Feb 8, 2024 · 2 comments
Assignees
Labels
Pick me up small effort, self contained issues to do when you feel like a pick me up, waiting to be unblocked… Rota Any issues that have come in as part of rota. Useful for the person on rota to track their work.
Milestone

Comments

@SiAdcock
Copy link
Contributor

SiAdcock commented Feb 8, 2024

The dev workflow of running DCR alongside frontend is currently broken. We are attempting to load JavaScript assets from the wrong place, so JavaScript doesn't get loaded in this scenario.

You can run both frontend and DCR then hit the frontend port on localhost:

http://localhost:3000

DCR's rendered output generates a relative path with a leading slash that roots the path:

<script type="module" src="/assets/frameworks.client.web.js"></script>
<script type="module" src="/assets/index.client.web.js"></script>

Because you're hitting frontend at localhost:3000, the browser attempts to load asset scripts from:

http://localhost:3000/assets/index.client.web.js

Instead of:

http://localhost:3030/assets/index.client.web.js

First reported here.

@chrislomaxjones suggests taking inspiration from #5285 and #3471

It's possible this is a bug in frontend rather than DCR. If this is the case, we should probably write a check in frontend that loads paths beginning with /assets from localhost:3030 instead of localhost:3000.

@SiAdcock SiAdcock added Bug Rota Any issues that have come in as part of rota. Useful for the person on rota to track their work. labels Feb 8, 2024
@cemms1 cemms1 added the Pick me up small effort, self contained issues to do when you feel like a pick me up, waiting to be unblocked… label Feb 23, 2024
@alinaboghiu
Copy link
Member

I think I'm getting this issue regardless of which url I use for DCR?
I managed to get it working by making sure that we use the hashed asset map when running locally (by setting this fallback value to true): https://github.com/guardian/frontend/blob/main/common/app/common/configuration.scala#L415

@emdash-ie
Copy link
Contributor

emdash-ie commented Sep 12, 2024

I have also run into this problem locally when running frontend and DCR, with frontend pointing at CODE capi. Unfortunately tweaking that config value hasn’t worked for me (assuming the link above is slightly old and it’s supposed to point to assets.useHashedBundles?).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Pick me up small effort, self contained issues to do when you feel like a pick me up, waiting to be unblocked… Rota Any issues that have come in as part of rota. Useful for the person on rota to track their work.
Projects
None yet
Development

No branches or pull requests

7 participants
@alinaboghiu @SiAdcock @emdash-ie @cemms1 @JamieB-gu @DanielCliftonGuardian and others