'错误创建处理程序'GraphQL Apollo服务器在Lambda上不起作用

时间:2019-02-16 19:02:01

标签: lambda graphql apollo apollo-server

我正在尝试将我的Apollo GraphQL服务器作为演示部署到Lambda。

我正在使用UP部署到AWS,该函数创建良好并且上传似乎正常,但是在访问生成的URL时,我总是得到一个{"message": "Internal server error"}

检查日志时,看到以下错误:

"src/app.js: line 1: //: Is a directory"

"src/app.js: line 2: syntax error near unexpected token('“`

'src/app.js: line 2: `const { ApolloServer } = require('apollo-server-lambda');'

error creating handler: waiting for http://127.0.0.1:39907 to be in listening state: timed out after 15s

我的app.js的代码如下:

const { ApolloServer } = require('apollo-server-lambda');
const typeDefs = require('./schema');
const { createStore } = require('./utils');
const LaunchAPI = require('./datasources/launch');
const UserAPI = require('./datasources/user');
const store = createStore();
const resolvers = require('./resolvers');

const server = new ApolloServer({
    typeDefs,
    resolvers,
    engine: {
      apiKey: process.env.ENGINE_API_KEY
    },
    dataSources: () => ({
        launchAPI: new LaunchAPI(),
        userAPI: new UserAPI({ store }),
      })
});

exports.graphqlHandler = server.createHandler();

有人对原因有任何想法吗?或如何进一步诊断?因为我有点迷路。要添加的是,该应用程序可以在localhost上正常运行

0 个答案:

没有答案