【问题标题】:apollo server RDS and aws lambda阿波罗服务器 RDS 和 aws lambda
【发布时间】:2019-03-06 08:34:25
【问题描述】:

我正在使用 apollo-server-lambda 模块来创建一个连接到 RDS 数据库的 lambda。我可以正确连接到 RDS 的唯一方法是以下

    exports.graphqlHandler = function(event, context, callback) { 

     context.callbackWaitsForEmptyEventLoop = false;

     sequelize.authenticate()

    .then(() => {
     console.log('Connection has been established successfully.');
     callback(null, "just stop!");
    })
    .catch(err => {
      console.error('Unable to connect to the database:', err);
      callback("error");
    });

如何使用 Apollo 服务器 lambda createHandler 方法来做到这一点

【问题讨论】:

    标签: apollo apollo-server


    【解决方案1】:

    有人回答了我关于 github 问题的问题。

    const server = new ApolloServer({
     context: ({ context, event }) => {
      context. callbackWaitsForEmptyEventLoop = false;
     }
    })
    

    https://github.com/apollographql/apollo-server/issues/1479

    【讨论】:

      猜你喜欢
      • 2021-09-09
      • 2019-02-08
      • 2020-10-18
      • 2020-10-04
      • 2021-10-28
      • 2021-02-13
      • 1970-01-01
      • 2020-07-19
      • 2019-09-15
      相关资源
      最近更新 更多