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

Lambda server-function is unstable on AWS #189

Closed
ldlinhlxag opened this issue Aug 28, 2023 · 6 comments · Fixed by #208
Closed

Lambda server-function is unstable on AWS #189

ldlinhlxag opened this issue Aug 28, 2023 · 6 comments · Fixed by #208

Comments

@ldlinhlxag
Copy link

We're using open-next to build nextjs app.
We also use next-intl and next-auth in our project.
Refer: https://github.com/amannn/next-intl/tree/main/examples/example-next-13-next-auth
Deploy on AWS Services: CloudFront, S3, Lambda.
After deploy, all features works fine.
But our production is unstable.
Sometime, it cannot show homepage. Only return blank page with null text.
Check AWS CloudWatch log, it shows error:

2023-08-28T02:48:05.865Z b263eb20-4f6d-4e01-bb6d-3a2751e41411 ERROR TypeError: Cannot read properties of null (reading 'useCallback') at Object.useCallback (/var/task/node_modules/react/cjs/react.development.js:1646:21) at InsertedHTML (/var/task/node_modules/next/dist/server/app-render/app-render.js:861:52) at Je (/var/task/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.edge.production.min.js:121:272) at Z (/var/task/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.edge.production.min.js:128:91) at Ee (/var/task/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.edge.production.min.js:137:422) at AsyncLocalStorage.run (node:async_hooks:338:14) at Timeout._onTimeout (/var/task/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.edge.production.min.js:150:403) at listOnTimeout (node:internal/timers:569:17) at process.processTimers (node:internal/timers:512:7)

I created global-error and errors for each routing. It not catch anything.
When server-function return null with http status code is 200 ?

@khuezy
Copy link
Contributor

khuezy commented Aug 28, 2023

What nextjs version are you using? Be sure to stick to 13.4.12; see issues and PR for details regarding all the issues.

@ldlinhlxag
Copy link
Author

ldlinhlxag commented Aug 28, 2023

Hi @khuezy ,
We're using next 13.4.7
After change to 13.4.12, it show 2 errors more:

2023-08-28T08:33:05.671Z dbdc114f-29af-4257-9e2c-03fa362bb037 ERROR TypeError: (0 , _react.use) is not a function at ServerComponentWrapper (/var/task/node_modules/next/dist/server/app-render/create-server-components-renderer.js:78:31) at Ue (/var/task/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.edge.production.min.js:113:273) at Z (/var/task/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.edge.production.min.js:120:91) at Pe (/var/task/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.edge.production.min.js:129:423) at AsyncLocalStorage.run (node:async_hooks:338:14) at Timeout._onTimeout (/var/task/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.edge.production.min.js:146:166) at listOnTimeout (node:internal/timers:569:17) at process.processTimers (node:internal/timers:512:7)

2023-08-28T08:35:04.570Z d942864a-3331-41e1-9de3-c3591346c935 ERROR Error: Cannot access .propTypes on the server. You cannot dot into a client module from a server component. You can only pass the imported name through. at Object.get (/var/task/.next/server/chunks/425.js:12298:15) at validatePropTypes (/var/task/node_modules/react/cjs/react.development.js:2263:24) at Object.createElementWithValidation [as createElement] (/var/task/node_modules/react/cjs/react.development.js:2379:5) at /var/task/node_modules/next/dist/server/app-render/app-render.js:1063:57 at S (/var/task/.next/server/chunks/425.js:13453:13) at mb (/var/task/.next/server/chunks/425.js:13675:29) at AsyncLocalStorage.run (node:async_hooks:338:14) at Timeout._onTimeout (/var/task/.next/server/chunks/425.js:13727:19) at listOnTimeout (node:internal/timers:569:17) at process.processTimers (node:internal/timers:512:7)

These errors also occur with soure: https://github.com/amannn/next-intl/tree/main/examples/example-next-13-next-auth
when deploy on same server.

P/S: When we run 2 sources at local with 'yarn dev' , they work fine.
Run 'yarn build:open' then run with 'yarn start', they work fine, too.

@conico974
Copy link
Contributor

Yeah there is an issue right now with middleware rewrite and app dir.
For it to work correctly you'll need both this PR #169 and next 13.4.13+.

In the meantime you could try adding a catch all routes at the root, it might fix the issue

@ldlinhlxag
Copy link
Author

Thanks @conico974 , @khuezy .
Let me try it.

@khuezy
Copy link
Contributor

khuezy commented Aug 28, 2023

We're trying to get all the 13.4.13 fixes merged this week and get out a rc release some time next week. It might take a couple more weeks if we find other issues.

@ldlinhlxag
Copy link
Author

Thank you for telling me.

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

Successfully merging a pull request may close this issue.

3 participants