我正在尝试将我的无服务器 nodejs graphql api 转换为使用 typescript,但无服务器会引发错误,指出 graphql 处理程序不是函数。
错误信息:
Error: Serverless-offline: handler for 'hello' is not a function
at Object.createHandler (/home/savnik/serverless-webpack-typescript-apollo/node_modules/serverless-offline/src/functionHelper.js:221:11)
at handler (/home/savnik/serverless-webpack-typescript-apollo/node_modules/serverless-offline/src/ApiGateway.js:485:40)
at module.exports.internals.Manager.execute (/home/savnik/serverless-webpack-typescript-apollo/node_modules/@hapi/hapi/lib/toolkit.js:41:33)
at Object.internals.handler (/home/savnik/serverless-webpack-typescript-apollo/node_modules/@hapi/hapi/lib/handler.js:46:48)
at exports.execute (/home/savnik/serverless-webpack-typescript-apollo/node_modules/@hapi/hapi/lib/handler.js:31:36)
at Request._lifecycle (/home/savnik/serverless-webpack-typescript-apollo/node_modules/@hapi/hapi/lib/request.js:312:68)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at Request._execute (/home/savnik/serverless-webpack-typescript-apollo/node_modules/@hapi/hapi/lib/request.js:221:9)
目标是创建一个使用 typescript 并可离线用于开发目的的 apollo graphql api。
我在这里重现了这个问题: https ://github.com/savnik/serverless-webpack-typescript-apollo
对这个问题的根本原因有什么想法吗?