-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Adaptor with custom TypeORM model doing custom CRUD will run into EntityMetadataNotFoundError
"No metadata for "User" was found", in a serverless setting
#780
Comments
One solution I tried is to copy And I will run into this error instead: Also note: these errors only show up in a serverless setting. If I'm doing it locally everything works perfecto! |
EntityMetadataNotFoundError
"No metadata for "User" was found", in a serverless setting EntityMetadataNotFoundError
"No metadata for "User" was found", in a serverless setting
I've also opened a discussion of this here: vercel/vercel#5299 I think I know what's the main problem now. Probably something to do with the way Entity metadata is derived in TypeORM (which appers to be related to the file mames? Or something along that line. Haven't got the time to do a deep dive into TypeORM yet to confirm that.) Found a highly relevant issue opened last year in TypeORM: code minify causes "Entity metadata for e#activities was not found" typeorm/typeorm#4714 So my bet is that the vercel build process for serverless functions somehow messes up the name of custom models used in this manner and the models are safe iff the code & filenames have been prebuilt into a node_module like in NextAuth. My final solution is to clone & use NextAuth as a local dependency and have my custom models inside the next auth package. And that acutally gets rid of the errors in on Vercel = ) |
@archywillhe Thanks for the insights and work around you have posted! I have not been able to replicate this issue but I've tagged it with a bug so we are tracking it. Feedback, even anecdotal, from anyone else seeing or not seeing this bug is appreciated. |
Hi there! It looks like this issue hasn't had any activity for a while. It will be closed if no further activity occurs. If you think your issue is still relevant, feel free to comment on it to keep it open. (Read more at #912) Thanks! |
Hi there! It looks like this issue hasn't had any activity for a while. To keep things tidy, I am going to close this issue for now. If you think your issue is still relevant, just leave a comment and I will reopen it. (Read more at #912) Thanks! |
@iaincollins Quick question. I've gone through all the documentation and the threads in here. I have only seen CRUD operations mentioned in an old version of next auth here: https://www.npmjs.com/package/next-auth/v/1.1.3 with a file called next-auth.functions.js. What is the best way to do CRUD operations with say a MongoDB connection with Next Auth? Are there still built-in functions to do this? I have been unable to figure this last part out to deploy my application. |
@iaincollins just bumping this here - am getting ready to release our conversion to
gonna look in to it and will report back. we are on vercel serverless as well. |
Can Import entities directly to the data source options.
|
Background
This is working very well locally as well as on Heroku too. It just fails to work in a serverless setting such as Vercel. So quite a curious thing.
What I'm doing
I'm doing some customsiation on top of Next Auth where I take Next Auth's typeORM adaptor out and uses it in another API to do custom CRUD for my user table.
Basically I have this:
and I will take it out like this
const adapter = await adapterSingleton().getAdapter()
and uses it.But after deloying into a serverless setting (Vercel) I keep getting
EntityMetadataNotFoundError
when I'm trying to do custom CRUD. Somehow it can't derive the entity forUser
?Questions
fixes it? How do I use ormconfig.yml in this case?
What can I do in order to be able to do custom CRUD using NextAuth's Adaptor without running into this error in a serverless setting? (Was working so well locally!)
Or should I give up trying to get this work in TypeORM cuz TypeORM is not really designed to work in this scenaior if it is serverless?
Any tips on this will be appreicated! Thanks!
What are you trying to do
custom CRUD
Feedback
Documentation refers to searching through online documentation, code comments and issue history. The example project refers to next-auth-example.
The text was updated successfully, but these errors were encountered: