aws-amplify / amplify-hosting

AWS Amplify Hosting provides a Git-based workflow for deploying and hosting fullstack serverless web applications.
https://aws.amazon.com/amplify/hosting/
Apache License 2.0
457 stars 115 forks source link

HTTP ERROR 404 #3242

Closed m-adrees closed 1 year ago

m-adrees commented 1 year ago

Before opening, please confirm:

JavaScript Framework

React

Amplify APIs

Not applicable

Amplify Categories

No response

Environment information

``` # Put output below this line ```

Describe the bug

I have deployed a website using AWS amplify and the build was successful but I am getting an HTTP ERROR 404 https://main.d3i9rhg2l51kv8.amplifyapp.com/

Expected behavior

it should not be an error when we hit the link... it must be a website i deployed

Reproduction steps

connected the repo to the GitHub repo

Code Snippet

here is my package.json

// Put your code below this line.
{
  "name": "@uniswap/info",
  "private": true,
  "homepage": "https://casper-uniswap-v2-info.herokuapp.com/",
  "engines": {
    "node": "19.4.0"
  },
  "devDependencies": {
    "@popperjs/core": "^2.4.2",
    "@reach/portal": "^0.10.3",
    "@reach/router": "^1.2.1",
    "@types/jest": "^26.0.0",
    "@types/node": "^14.0.13",
    "@types/react": "^16.9.36",
    "@types/react-dom": "^16.9.8",
    "@types/styled-components": "^5.1.0",
    "@typescript-eslint/eslint-plugin": "^4.4.0",
    "@typescript-eslint/parser": "^4.4.0",
    "@uniswap/token-lists": "^1.0.0-beta.15",
    "ajv": "^6.12.4",
    "animated-number-react": "^0.1.1",
    "apollo-cache-inmemory": "^1.6.3",
    "apollo-client": "^2.6.4",
    "apollo-link-http": "^1.5.16",
    "bignumber.js": "^9.0.0",
    "color-contrast-checker": "^1.5.0",
    "copy-to-clipboard": "^3.3.1",
    "dayjs": "^1.8.16",
    "decimal.js-light": "^2.5.0",
    "es-abstract": "^1.14.2",
    "eslint": "^6.8.0",
    "eslint-config-prettier": "^6.12.0",
    "eslint-plugin-prettier": "^3.1.4",
    "eslint-plugin-react": "^7.21.3",
    "eslint-plugin-react-hooks": "^4.1.2",
    "ethers": "^4.0.39",
    "export-to-csv": "^0.2.1",
    "feather-icons": "^4.24.1",
    "graphql": "^14.5.6",
    "graphql-tag": "^2.10.1",
    "jazzicon": "^1.5.0",
    "lightweight-charts": "^3.1.3",
    "node-vibrant": "^3.1.5",
    "numeral": "^2.0.6",
    "polished": "^3.4.4",
    "prettier": "^2.1.2",
    "react": "^16.9.0",
    "react-apollo": "^3.1.1",
    "react-device-detect": "^1.9.10",
    "react-dom": "^16.9.0",
    "react-feather": "^2.0.3",
    "react-ga": "^3.1.2",
    "react-iframe": "^1.8.0",
    "react-parallax": "^2.2.4",
    "react-popper": "^2.2.3",
    "react-resize-observer": "^1.1.1",
    "react-router-dom": "^5.2.0",
    "react-scripts": "^3.1.1",
    "react-scroll": "^1.8.0",
    "react-scroll-parallax": "^2.2.0",
    "react-select": "^3.0.7",
    "react-spring": "^8.0.27",
    "react-springy-parallax": "^1.3.0",
    "react-switch": "^5.0.1",
    "react-use": "^12.2.0",
    "rebass": "^4.0.7",
    "recharts": "^1.7.1",
    "recharts-fork": "^1.7.2",
    "styled-components": "^4.3.2",
    "toformat": "^2.0.0",
    "typeface-inter": "^3.10.0",
    "typescript": "^3.9.5",
    "unstated": "^2.1.1",
    "wcag-contrast": "^3.0.0"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  },
  "license": "GPL-3.0-or-later"
}

Log output

``` // Put your logs below this line ```

aws-exports.js

No response

Manual configuration

No response

Additional configuration

No response

Mobile Device

No response

Mobile Operating System

No response

Mobile Browser

No response

Mobile Browser Version

No response

Additional information and screenshots

No response

nadetastic commented 1 year ago

Hi @adrees-scytalelabs, thanks for opening this issue - Just to confirm, does the 404 only happen when you deploy to Amplify? In other words, is it working locally?

m-adrees commented 1 year ago

yes, it is working locally fine.

Jay2113 commented 1 year ago

@adrees-scytalelabs 👋 , apologies for the delayed response. The 404 error occurs as we did not detect an index.html file within the baseDirectory of your buildSpec (amplify.yml file). Kindly modify your buildSpec as follows to set the baseDirectory to build and then redeploy your Amplify app:

version: 1
frontend:
  phases:
    preBuild:
      commands:
        - npm ci
    build:
      commands:
        - npm run build
  artifacts:
    baseDirectory: build
    files:
      - '**/*'
  cache:
    paths:
      - node_modules/**/*
github-actions[bot] commented 1 year ago

This issue has not received a response in a while. If you want to keep this issue open, please leave a comment below and auto-close will be canceled.

github-actions[bot] commented 1 year ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.