:wave: I follow: <https://serverless-stack.com/exa...
# help
k
đź‘‹ I follow: https://serverless-stack.com/examples/how-to-create-a-nextjs-app-with-serverless.html after adding
@serverless-stack/static-site-env
to frontend and
@sls-next/lambda-at-edge
to root I get this nonsens error when I run yarn start (backend) and yarn dev (frontend). I have latest deps, node v16.15.1, using yarn
Copy code
TypeError: Cannot read properties of null (reading 'useContext')
Warning: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
1. You might have mismatching versions of React and the renderer (such as React DOM)
2. You might be breaking the Rules of Hooks
3. You might have more than one copy of React in the same app
See <https://reactjs.org/link/invalid-hook-call> for tips about how to debug and fix this problem.
TypeError: Cannot read properties of null (reading 'useContext')
a
Never seen this error before. Are you just doing the example or use it as base for your own code?
if it's just the example, you could also try cloning my repo here, just to confirm whether it's your project setup, or maybe something else that interferes with your environment: https://github.com/adsc/sst-nextjs.git
k
I noticed it's working with
npm
but I want to use yarn workspaces
this is bummer
I think the issue is somehow related to yarn workspaces
f
which version of
npm
r u using.
npm
8 also has support workspaces and hoists the
node_modules
. I wonder if that works for u.
k
ok, so I removed. "frontend" from workspaces array in package.json and it works with yarn
f
Oh i see.. i wonder if Next.js doesn’t work well with yarn workspace?