-
Notifications
You must be signed in to change notification settings - Fork 348
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
Wrong typings #5116
Comments
Also Context doesn't contains req/res objects. 😕 |
@Warxcell About returning errors, does Also be careful with the in-context SDK because data manipulation should be done very carefully there. If the return types don't match, Mesh will take the selection set of the current resolved field and this might be the thing you want;
So
|
As fas as I saw: all the context is generated by envelop plugins - in that case - woudn't be best if mesh is started programatically rather than with command that does something behind the scenes? That way context will work out-of-the-box and no need to worry about adding plugins. Right now I have custom context and I put it everywhere as typehint, but that doesn't guarantee from end-2-end that it works.
one could care only about success results? in that case it can just forward the error. with current typings that is not possible either, because GraphQLError is not assignable to return type of then which is the type itself.
true, but use-case is other: there is a resolver composition, on calling API 1, it modifies the args by calling API 2 - .then is used to modify the args - which is not concern of valuesFromResults, no? |
@Warxcell Mesh CLI allows you to start a server using Node.js in an easier way. If you want to have a custom server configuration, you can use HTTP handler and pass the context however you want. For example in AWS Lambda, we pass the context like that. Going back to the error handling, I am a bit confused :) When you call a method from an in-context SDK, it rejects the promise in case of an error or resolves with the data as typed. Resolvers composition might make things tricky here which I need to see in an example probably. Maybe you can create a very minimal isolated sandbox on CodeSandbox or StackBlitz just for that. |
Actually no - in case of error - it resolves with the error. |
Issue workflow progress
Progress of the issue based on the
Contributor Workflow
Github,
Stackblitz
or
CodeSandbox
Describe the bug
on stitching resolver: the return type is wrong
it says the return types is the Object returned by the graphql schema, but it says nothing about graphql errors - so you actually miss them, until they blow in your face at runtime as shown with this commit.
Furthermore:
.then((data) => ...)
has a wrong type also, when stitching is batched. ( Warxcell/graphql-mesh-wrong-typing@5790275 )as seen on log:
To Reproduce Steps to reproduce the behavior:
https://github.com/Warxcell/graphql-mesh-wrong-typing
Expected behavior
return type to be the type from graphql | Error.
Environment:
not related, versions are seen in the repo.
Additional context
The text was updated successfully, but these errors were encountered: