Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

WebSPA: An unhandled exception occurred while processing the request. #2082

Open
cosmic-flood opened this issue Apr 9, 2023 · 4 comments
Open

Comments

@cosmic-flood
Copy link

I initiated the eShopOnContainer service, and http://host.docker.internal:5100/ was running smoothly. However, http://host.docker.internal:5104/ encountered an error, as shown below.

image

NPM and Node.js have been globally installed with the most recent versions.

Could you help me figure this out?

@erjain
Copy link
Contributor

erjain commented Apr 9, 2023

It should be worked around by following the below steps:

Update Docker file:
Go to the eShopOnContainers\src\Web\WebSPA\Dockerfile

Add the below commands just after the line WORKDIR /app

RUN apt-get update
RUN apt-get -y install curl gnupg
RUN curl -sL https://deb.nodesource.com/setup_16.x | bash -
RUN apt-get -y install nodejs
RUN npm install
RUN npm -v

image

Update the environment variable in the docker-compose.override.yml file.
For the webspa service, change the value of ASPNETCORE_ENVIRONMENT variable from Production to Development just like as per below:

  • ASPNETCORE_ENVIRONMENT=Development
    image

@cosmic-flood
Copy link
Author

It should be worked around by following the below steps:

Update Docker file: Go to the eShopOnContainers\src\Web\WebSPA\Dockerfile

Add the below commands just after the line WORKDIR /app

RUN apt-get update RUN apt-get -y install curl gnupg RUN curl -sL https://deb.nodesource.com/setup_16.x | bash - RUN apt-get -y install nodejs RUN npm install RUN npm -v

image

Update the environment variable in the docker-compose.override.yml file. For the webspa service, change the value of ASPNETCORE_ENVIRONMENT variable from Production to Development just like as per below:

  • ASPNETCORE_ENVIRONMENT=Development
    image

I've already implemented code you mentioned (and also mentioned on wiki page)

If I change RUN curl -sL https://deb.nodesource.com/setup_12.x | bash - to RUN curl -sL https://deb.nodesource.com/setup_16.x | bash -, I got error below.

image

If I change nothing, I got the error of this issue

@erjain
Copy link
Contributor

erjain commented Apr 25, 2023

Hi @ cosmic-flood, I suggest you delete the existing repo and download it again from GitHub. Check for the correct version of npm and node. Try cleaning up the old docker images and building the docker images again. - To build and run the app

  • Go to the /src/ directory and first-time build without cache
docker-compose build --no-cache
  • then, run
docker-compose up sqldata
  • Once it's ready to accept the new connection, you can bring up the other container using the following command from a separate terminal window.
docker-compose up

Let us know if this works for you.

@cosmic-flood
Copy link
Author

Thank you, I'll try again next week. I'm currently on vacation.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants