Skip to content
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

Unable to switch existing apollo federation gateway supporting azure function with apollo-server-integration-azure-functions #30

Open
mdv27 opened this issue Mar 9, 2023 · 0 comments

Comments

@mdv27
Copy link

mdv27 commented Mar 9, 2023

Existing function

import { AzureFunction, Context, HttpRequest } from "@azure/functions";
import { ApolloServer } from "apollo-server-azure-functions";
import { ApolloGateway } from "@apollo/gateway";
import { ApolloServerPluginLandingPageGraphQLPlayground } from 'apollo-server-core';

const startApollo = () => {
  let handler: AzureFunction | undefined;
  const init = async () => {
    const gateway = new ApolloGateway({
      serviceList: [
        { name: 'subgraph-api', url: 'https://localhost:7071/api/graphql' }
      ]
    });
    const { schema, executor } = await gateway.load();
    const server = new ApolloServer({ schema, executor: executor as any, plugins: [ApolloServerPluginLandingPageGraphQLPlayground]});
    handler = server.createHandler()
    console.log("Apollo server started.");
  };

  init();

  return (context: Context, req: HttpRequest) => {
    if (handler) handler(context, req);
  };
};

exports.graphqlHandler = startApollo();

ApolloServer class in @apollo/server v4 does not support above constructor param executor. Also createHandler() not present. Please help.

@mdv27 mdv27 changed the title Unable to switch existing apollo federation gateway with apollo-server-integration-azure-functions Unable to switch existing apollo federation gateway supporting azure function with apollo-server-integration-azure-functions Mar 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant