TencentCloudBase / cloudbase-templates

云开发工程模板示例,可通过 CloudBaseFramework 一键创建和部署
https://github.com/TencentCloudBase/cloudbase-framework
Apache License 2.0
206 stars 107 forks source link

部署后显示Internal Server Error #64

Closed gtfd333 closed 3 years ago

gtfd333 commented 3 years ago

日志没有报错,本地启动一切正常。不知道什么原因。tcb到服务器上就是不行。

部署后访问显示Internal Server Error

START RequestId:f3d58e58-a97c-11eb-8fcd-525400dd5846

f3d58e58-a97c-11eb-8fcd-525400dd5846 n  TypeError: this.socket.setTimeout is not a functionn     
 at ServerlessResponse.setTimeout (_http_outgoing.js:191:17)n      
 at /var/user/node_modules/think-meta/index.js:23:15n      
 at dispatch (/var/user/node_modules/koa-compose/index.js:42:32)n     
 at /var/user/node_modules/koa-compose/index.js:34:12n      
 at Application.handleRequest (/var/user/node_modules/koa/lib/application.js:168:12)n      
 at handleRequest (/var/user/node_modules/koa/lib/application.js:150:19)n      
 at request (/var/user/node_modules/serverless-http/lib/framework/get-framework.js:9:5)n      
 at provider (/var/user/node_modules/serverless-http/serverless-http.js:19:28)n

2021-04-30 14:26:10 f3d58e58-a97c-11eb-8fcd-525400dd5846 {"traceId":"8e2971a5755c494689a0a0397ac5c4c9","httpPath":"/thinkjs-starter","childOf":"","source":"http","invoker":"","ua":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.85 Safari/537.36 Edg/90.0.818.46","invokerIp":"220.194.231.141","spanId":"a8578e186b70b0ad","service":"function","domain":"test-php-3gcxe2mobc10382b-1252709890.ap-shanghai.app.tcloudbase.com","startTime":"1619763969679","event":"GET","timeCost":"407","statusCode":"500"}

REPORT RequestId:f3d58e58-a97c-11eb-8fcd-525400dd5846 Duration:389ms Memory:128MB MemUsage:26.308594MB

END RequestId:f3d58e58-a97c-11eb-8fcd-525400dd5846
gtfd333 commented 3 years ago

找到问题了 { handle: 'meta', options: { requestTimeout: 10 * 1000, //request timeout, default is 10s requestTimeoutCallback: (ctx, options) => { ctx.body = '请求超时!'; }, sendPowerBy: isDev, sendResponseTime: isDev, logRequest: isDev } },

中间件问题,因为是容器服务,调用后就关闭了,所以有这个异常