zeit now v2+;apollo server express:游乐场错误:无法访问服务器

zeit now v2+;apollo server express:游乐场错误:无法访问服务器,express,graphql,apollo-server,express-graphql,vercel,Express,Graphql,Apollo Server,Express Graphql,Vercel,目前,我正试图为我的nextjs项目获得一个api。 对于部署,我使用zeit的NOW v2(通过“NOW dev”本地) 除了graphql服务器,其他一切都正常工作 在操场上,通过客户端,我得到一个404错误。 查询得到正确执行,但我得到一个错误对象(查询结果在response字段中;404) 在操场gui中检查:同样的问题,在操场输入字段中显示消息“无法访问服务器” 初始错误: { "error": "Response not successful: Received status c

目前,我正试图为我的nextjs项目获得一个api。 对于部署,我使用zeit的NOW v2(通过“NOW dev”本地)

除了graphql服务器,其他一切都正常工作

在操场上,通过客户端,我得到一个404错误。 查询得到正确执行,但我得到一个错误对象(查询结果在response字段中;404)

在操场gui中检查:同样的问题,在操场输入字段中显示消息“无法访问服务器”

初始错误:

{
  "error": "Response not successful: Received status code 404"
}
查询后的操场:

{
  "error": {
    "data": {
      "hello": "Hello world!"
    }
  }
}
浏览器控制台:

Error: "Response not successful: Received status code 404"
这是我的graphql服务器,现在已加载:

import express from 'express';
import { ApolloServer, gql } from 'apollo-server-express';

const typeDefs = gql`
    type Query {
        hello: String
    }
`;

const resolvers = {
    Query: {
        hello: () => 'Hello world!',
    },
};

const server = new ApolloServer({ typeDefs, resolvers,
                                    introspection: true, playground: true,
                                    subscriptions: {path: '/api'},
                                });

const app = express();
server.applyMiddleware({ app, path: "/api", cors: true });

module.exports = app;
我也试过这个例子。同样的问题

有人能告诉我如何让它正常运行吗?

我遇到了类似的问题(无法联系到服务器)。这是一个授权问题。提及
请求。凭据设置:

const server = new ApolloServer({
    typeDefs,
    resolvers,
    introspection: true,
    playground: {
      settings: {
        // So that auth works
        // Docs: https://github.com/prisma/graphql-playground
        ['request.credentials']: 'same-origin',
      },
    },
    subscriptions: {path: '/api'}
});