opennextjs / opennextjs-aws

Open-source Next.js adapter for AWS
https://open-next.js.org
MIT License
3.96k stars 119 forks source link

[GUIDANCE] Warmer function not warming #528

Closed pinarruiz closed 2 hours ago

pinarruiz commented 1 day ago

Hello,

We have a website cecohomes.cecotec.dev, beware of autoplay.

We have the warmer configured and logs look good, here is a test event screenshot:

Test event screenshot Cloudwatch Logs

But the website loads extremely slow when first user tries to access it.


Node version: 20.17.0

WARM_PARAMS: [{ "concurrency": 15, "function": "cecohomes-front-serverless-open-next-dev-server" }]

package.json:

{
  "name": "cecohomes",
  "version": "0.1.0",
  "private": true,
  "packageManager": "yarn@1.22.21",
  "dependencies": {
    "@cecotec/shared-components": "^1.3.14",
    "@emotion/react": "^11.1.5",
    "@emotion/styled": "^11.3.0",
    "@react-spring/web": "^9.6.1",
    "axios": "^1.2.2",
    "classnames": "^2.3.2",
    "formik": "^2.2.9",
    "google-map-react": "^2.1.10",
    "i": "^0.3.7",
    "i18next": "^22.4.9",
    "i18next-browser-languagedetector": "^7.0.1",
    "leaflet": "^1.8.0",
    "leaflet-defaulticon-compatibility": "^0.1.1",
    "leaflet-gesture-handling": "^1.2.2",
    "next": "^12.1.6",
    "nextjs-progressbar": "0.0.16",
    "npm": "^9.3.1",
    "react": "^17.0.2",
    "react-cookie": "^4.0.3",
    "react-dom": "^17.0.2",
    "react-image-lightbox": "^5.1.4",
    "react-imgix": "^9.6.0",
    "react-leaflet": "^4.0.0",
    "react-multi-carousel": "^2.8.2",
    "react-render-html": "^0.6.0",
    "react-router-dom": "^5.2.0",
    "react-select": "^5.3.1",
    "react-use": "^17.4.0",
    "swiper": "^11.1.14",
    "typescript": "^4.3.2",
    "yup": "^0.32.11"
  },
  "devDependencies": {
    "@babel/preset-react": "^7.14.5",
    "@next/eslint-plugin-next": "^13.1.1",
    "@svgr/cli": "^5.5.0",
    "@svgr/webpack": "^5.5.0",
    "@trivago/prettier-plugin-sort-imports": "^4.0.0",
    "@types/jest": "^26.0.24",
    "@types/leaflet": "^1.7.10",
    "@types/react": "^18.0.26",
    "@types/react-imgix": "^9.5.0",
    "@typescript-eslint/eslint-plugin": "^5.48.1",
    "@typescript-eslint/parser": "^5.48.1",
    "babel-jest": "^27.0.6",
    "cypress": "^8.0.0",
    "eslint": "^8.31.0",
    "eslint-config-prettier": "^8.6.0",
    "eslint-plugin-prettier": "^4.2.1",
    "eslint-plugin-react": "^7.31.11",
    "gulp": "^4.0.2",
    "gulp-file": "^0.4.0",
    "gulp-filelist": "^2.0.5",
    "gulp-merge-json": "^2.1.2",
    "husky": "^8.0.3",
    "jest": "^27.0.6",
    "jest-matcher-specific-error": "^1.0.0",
    "jest-mock-axios": "^4.7.0-beta3",
    "open-next": "3.1.3",
    "prettier": "^2.8.2",
    "pretty-quick": "^3.1.3",
    "react-test-renderer": "^17.0.2",
    "reflect-metadata": "^0.1.13",
    "serverless": "3.38.0",
    "serverless-iam-roles-per-function": "3.2.0",
    "serverless-plugin-lambda-insights": "2.0.0",
    "serverless-prune-plugin": "2.0.2",
    "serverless-s3-sync": "3.2.0",
    "through2": "^4.0.2",
    "ts-jest": "^27.0.3"
  }
}

Thanks for any responses, if any more information is needed, i will provide it.

conico974 commented 1 day ago

The warmer function does not preload the route themselves, only the shared deps like NextServer get preloaded.

The only solution for that would be to preload the route you want https://opennext.js.org/aws/config/custom_overrides#preload-some-routes-during-warmer-event. One thing to keep in mind is while it preloads it cannot serve request, you don't want to preload a lot of route this way.

Couple of things i've noticed here as well:

pinarruiz commented 2 hours ago

Ohh, okay i see, thanks for the clarification @conico974.