Closed wouter-deen closed 1 year ago
Hey man @ijjk I saw you were really active on the previous issues regarding this same behavior. Do you know if there were any changes that might have broken the previous fix for this issue by chance?
Ps. srry for pinging, just saw your name drop by a lot in the previous issues where the issue was the same behavior. 💯
I identified the problem to be that Mongoose doesn't handle enums well. When changing the enum to a type
in my model and changing some code, it works fine. I will update my issue on the Mongoose repo accordingly and close this issue. For anyone that has the same problem, see this issue: https://github.com/Automattic/mongoose/issues/13261.
Well this enum things is still very surprising. I currently still see the missing modules seen on this issue while adding "mongo" to severComponentsExternalPackages option
@ijjk I couldn't comment on #42277 but I am not sure the "serverComponentsExternalPackages" config is enough in all situations. It doesn't seem to work for me, perhaps because I use pnpm, I still have issues with mongo
Here are my logs (extremely hard to build a minimal repro sorry, I am suing 13.4):
Import trace for requested module:
../node_modules/.pnpm/@aws-sdk+util-user-agent-node@3.306.0/node_modules/@aws-sdk/util-user-agent-node/dist-cjs/is-crt-available.js
../node_modules/.pnpm/@aws-sdk+util-user-agent-node@3.306.0/node_modules/@aws-sdk/util-user-agent-node/dist-cjs/index.js
../node_modules/.pnpm/@aws-sdk+client-cognito-identity@3.306.0/node_modules/@aws-sdk/client-cognito-identity/dist-cjs/runtimeConfig.js
../node_modules/.pnpm/@aws-sdk+client-cognito-identity@3.306.0/node_modules/@aws-sdk/client-cognito-identity/dist-cjs/CognitoIdentityClient.js
../node_modules/.pnpm/@aws-sdk+client-cognito-identity@3.306.0/node_modules/@aws-sdk/client-cognito-identity/dist-cjs/index.js
../node_modules/.pnpm/@aws-sdk+credential-providers@3.306.0/node_modules/@aws-sdk/credential-providers/dist-cjs/fromCognitoIdentity.js
../node_modules/.pnpm/@aws-sdk+credential-providers@3.306.0/node_modules/@aws-sdk/credential-providers/dist-cjs/index.js
../node_modules/.pnpm/mongodb@5.4.0_k6g22hirxxolmpmmi2eqykttpy/node_modules/mongodb/lib/deps.js
../node_modules/.pnpm/mongodb@5.4.0_k6g22hirxxolmpmmi2eqykttpy/node_modules/mongodb/lib/index.js
../shared/mongo/mongo.ts
../shared/mongo/index.ts
This perhaps the import is not correctly matched as something corresponding to "mongodb" NPM package?
This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.
Verify canary release
Provide environment information
Which area(s) of Next.js are affected? (leave empty if unsure)
App directory (appDir: true)
To Reproduce
I seem to have the exact same issue as this: https://github.com/vercel/next.js/issues/42277. However, this issue should have been resolved a while back. I'm running the most up-to-date version of NextJS (at the time of writing) and somehow, I still seem to get the same problem. The issue seems to be specifically happening in my Activity Mongoose model (all my other models don't produce this issue):
I am posting this here instead of in the Mongoose or MongoDB repos, since it seems very likely that this is a bug with NextJS rather than those, given the linked issue above.
Describe the Bug
Please refer to linked issue for more info. This is my log:
Expected Behavior
The pages work fine, but they are very slow (compared to other pages that don't use MongoDB/Mongoose for data fetching). Also, building with Vercel gives me a lot of errors (missing dependencies).
Which browser are you using? (if relevant)
No response
How are you deploying your application? (if relevant)
Vercel