-
-
Notifications
You must be signed in to change notification settings - Fork 677
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
Adding argument decorator breaks azure functions #303
Comments
I'm not sure but it looks like Azure Functions is using babel-typescript which doesn't support argument decorators - see #55. Catching the error will swallow the error and it will result in no args registering in TypeGraphQL. Please try to investigate the decorators support in Azure Functions by creating own custom decorators with console.log to check if they are transpiled and evaluated properly. Then we can dig in to see the reflected metadata for parameters. |
When I catch the error I don't notice any adverse effects, graphql still works perfectly - perhaps there's some quality of life features which are breaking that I'm unaware of? I'll try to do what you asked however I think you're right and it's simply azure functions not supporting it. Your comment on the 8th of Feb in that thread about calling it as a function seems like an acceptable work around, I'll try that as well to see if it helps. Otherwise I'll probably move to a different platform (google firebase functions perhaps?) - the way I see it is type-graphql is definitely worth switching functions platforms for because it offers something very valuable. |
Based on #323, you should use So closing this as a duplicate of #55 🔒 |
I wasn't able to get this to work using the plugin you suggested because there's no webpack.config.json included, in the end the solution was to install https://www.npmjs.com/package/reflect-metadata and enable emitDecoratorMetadata and experimentalDecorators in tsconfig, set target to es6 and add 'import reflect-metadata' to the top of tiles using decorators. |
That are the basic things described in installation section: Weird that it worked except argument decorator 😕 |
Set |
I'm using type-graphql with Azure Functions typescript, everything works except when I try to create input types, like so:
@arg("title") seems to be breaking azure functions, when it's in there I get the following error when I try to deploy and test the function locally:
I tracked the issue down to findType.js and much to my surprise wrapping reflectedType[parmaterIndex] in a try/catch it worked fine:
I'm not suggesting this as a fix as I haven't fully tested it beyond the simple example given above, but thought it would be worth bringing up for discussion.
The text was updated successfully, but these errors were encountered: