Open MirrorBytes opened 3 years ago
Do you need to enable "emitDecoratorMetadata": true
somewhere in TSConfig?
@babichjacob Already done, along with "experimentalDecorators" being set to true. It's doing it for Entities and Resolvers
Can you provide a repository?
@babichjacob Sorry, had to create one: https://github.com/MirrorBytes/phorm-kit-vercel I trimmed a bit out, including the database connection.
I'll have to leave this issue open for a few days because school has to be a higher priority right now. I'm sorry.
No need to be sorry! I can't seem to figure out if this is a problem with decorators and metadata in sveltekit or specifically graphql.
@babichjacob
So, I moved the graphql implementation to the api
directory that vercel uses, and changed the function to a vercel centric one. It stills errors.
However, if I ditch graphql-helix and use apollo-server-micro, everything works as expected. I believe this is an issue with graphql-helix not liking type-graphql and/or metadata reflection.
I'll update the repo in a little bit incase anyone else has this issue.
Wait, I lied. This has nothing to do with graphql-helix. It's to do with sveltekit and type reflection, just tried to move it out of the api
directory, and it's doing the exact same thing.
I opened an issue in the SvelteKit repo as I think it pertains to that as opposed to this library: https://github.com/sveltejs/kit/issues/798
Relevant upstream issue / comment: https://github.com/sveltejs/kit/issues/1327#issuecomment-831901931
Type reflection seems to be buggy. I'm getting random errors like this:
"Unable to infer GraphQL type from TypeScript reflection system. You need to provide explicit type for 'XXXX' of 'XXXX' class."
This is happening with
reflect-metadata
being imported in the endpoint and the schema file. Importing it into each individual class file doesn't seem to work either. Any ideas?