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

Npm run dev not working correctly in status api folder #2454

Closed
tuanthanh2067 opened this issue Nov 9, 2021 · 1 comment · Fixed by #2494
Closed

Npm run dev not working correctly in status api folder #2454

tuanthanh2067 opened this issue Nov 9, 2021 · 1 comment · Fixed by #2494
Assignees
Labels
area: microservices area: web server Issues related to the web server developer experience Helping the Developer Experience type: bug Something isn't working

Comments

@tuanthanh2067
Copy link
Contributor

What happened: When I try to test /src/api/status locally by using npm run dev, I received a page that looks messed up

What should have happened: It should load css and javascript properly

How to reproduce it (as precise as possible): Go to /src/api/status, then npm install, then npm run dev, and then open up your google chrome and then redirect to http://localhost:1111/

Anything else we need to know?: It seems like <base> at line 19 needs to be altered

Environment:

  • OS: MacOS 12
  • Browser: Google Chrome
@tuanthanh2067 tuanthanh2067 added the type: bug Something isn't working label Nov 9, 2021
@humphd
Copy link
Contributor

humphd commented Nov 9, 2021

The root of the problem here is that we're compensating for how our API router (Traefik) works in production, where we add /v1/status/* as a prefix, see https://github.com/Seneca-CDOT/telescope/blob/master/docker/docker-compose.yml#L34. To get around this, we added a <base href="/v1/status/" /> element to the page in order to resolve all links relative to /v1/status, see https://github.com/Seneca-CDOT/telescope/blob/master/src/api/status/public/index.html#L19. When this is run in development (i.e., outside of Docker and without Traefik), we are serving everything from / vs. /v1/status, see https://github.com/Seneca-CDOT/telescope/blob/master/src/api/status/src/server.js#L23.

A possible fix would be to add a variable to https://github.com/Seneca-CDOT/telescope/blob/master/src/api/status/env.local which we then check for before https://github.com/Seneca-CDOT/telescope/blob/master/src/api/status/src/server.js#L23, and either use / or /v1/status as the root, perhaps also adding a redirect from / -> /v1/status so people can just go to /.

Fixing this is pretty high priority, since it affects everyone working on the dashboard. I saw @Andrewnt219 asking about it in #2415, and others on Slack.

@humphd humphd added area: microservices area: web server Issues related to the web server developer experience Helping the Developer Experience Priority: High labels Nov 9, 2021
@sirinoks sirinoks self-assigned this Nov 10, 2021
@sirinoks sirinoks linked a pull request Nov 19, 2021 that will close this issue
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: microservices area: web server Issues related to the web server developer experience Helping the Developer Experience type: bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants