aws-amplify / amplify-backend

Home to all tools related to Amplify's code-first DX (Gen 2) for building fullstack apps on AWS
Apache License 2.0
166 stars 55 forks source link

Deploy Angular project #1694

Closed v-alex-dev closed 3 months ago

v-alex-dev commented 3 months ago

Environment information

System:
  OS: Windows 11 10.0.22631
  CPU: (4) x64 Intel(R) Core(TM) i5-2500K CPU @ 3.30GHz
  Memory: 2.64 GB / 7.97 GB
Binaries:
  Node: 20.14.0 - C:\Program Files\nodejs\node.EXE
  Yarn: undefined - undefined
  npm: 10.8.1 - C:\Program Files\nodejs\npm.CMD
  pnpm: undefined - undefined
NPM Packages:
  @aws-amplify/backend: 1.0.3
  @aws-amplify/backend-cli: 1.0.4
  aws-amplify: 6.3.8
  aws-cdk: 2.147.1
  aws-cdk-lib: 2.147.1
  typescript: 5.4.5
AWS environment variables:
  AWS_NODEJS_CONNECTION_REUSE_ENABLED = 1
  AWS_STS_REGIONAL_ENDPOINTS = regional
No CDK environment variables

Description

Hello everyone. I'd like to deploy my angular application on its latest version. The first build in aws amplify failed. The node js version was not sufficient. So I added a build image of node.js 20. The depolyming was done correctly.

However, when I clicked on the link to the deployed site. I get a 404 http error.

Which isn't even the one I created. The project is like not found.

v-alex-dev commented 3 months ago

If you want to see the result of the (successful) deployment https://master.d257nvidu1xe7a.amplifyapp.com/

Jay2113 commented 3 months ago

Hi @v-alex-dev 👋 , thanks for reaching out. I noticed that your app's amplify.yml file specifies the baseDirectory: dist/aspic-site. The 404 error can occur if the index.html file is missing from this deploy folder.

To identify the correct build directory, run a production build of your app locally and observe the output directory created. Then, update the baseDirectory field in amplify.yml accordingly.

v-alex-dev commented 3 months ago

Mmh. Yes, I noticed that the "index.html" file is in the /dist/aspic-site/browser folder.

But isn't the browser folder taken into account by default in the browser?

v-alex-dev commented 3 months ago

I just got my answer. Obviously not. You need to specify the browser folder in the amplify.yml file.

I've obviously made a nasty shortcut.

Thanks for your help

Jay2113 commented 3 months ago

@v-alex-dev I am glad to hear that you are unblocked! Closing the thread.