-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Typing issues with "ApolloServerExpressConfig" in version 2.4.8 #2469
Comments
Any chance that issue will be addressed? Thanks! |
Looks like you've reported two separate problems in one issue. In the future, it's best to separate those out, particularly since the PR you opened to fix them only fixes one of the two! That said, could you please provide a small, runnable reproduction (even if it crashes) which demonstrates this. I haven't run into this problem yet, but I'm worried that adding an additional non-required Thanks! |
@abernix You are right separating would be better, sorry for that :). I think we can forget about the formatErrors problem anyway, since apollo-errors package seems deprecated. Concerning the pull request: You can take the example from the docs:
The current typings won't allow that because they don't know the connection parameter. It's not an error (in javascript it works fine), but the typescript transpiler won't let you pass. |
any update on this? I tried to add the fix from the PR export interface ExpressContext {
req: express.Request;
res: express.Response;
connection?: ExecutionParams;
} idk where ExecutionParams was coming from and it doesn't exist |
Should have been fixed by #2959! |
Since upgrading from apollo-server-express 2.4.2 to 2.4.8 I have two typing issues with the ApolloServer config used in the constructor:
1.) I can't use the "formatError" from the apollo-erros package (version1.9.0) anymore. I get this error:
Type '(error: any, returnNull?: boolean) => ErrorInfo' is not assignable to type '(error: GraphQLError) => GraphQLFormattedError'. Type 'ErrorInfo' is not assignable to type 'GraphQLFormattedError'. Property 'locations' is optional in type 'ErrorInfo' but required in type 'GraphQLFormattedError'.
2.) I can't access the "connection" parameter anymore from the context creation function (it returns an "ExpressContext"). It's not a recognized parameter anymore.
But in the docs it's still the propesed way to create context for subscriptions: https://www.apollographql.com/docs/apollo-server/features/subscriptions.html#Context-with-Subscriptions
I have to stick with version 2.4.2 until this problem is resolved.
Thanks for any help.
The text was updated successfully, but these errors were encountered: