serverless / serverless-tencent

⚡️ 🐧 Serverless Tencent CLI 及中文讨论社区
https://cn.serverless.com
63 stars 26 forks source link

更新缓存代码失败 #195

Closed wx2020 closed 2 years ago

wx2020 commented 2 years ago

BUG 描述:

coding.net 平台使用 slt 部署云函数失败。

复现步骤:

slt deploy --debug --force

预期结果:

部署成功

实际结果:

[2022-05-04 16:20:10] + slt deploy --debug --force
[2022-05-04 16:20:10] 正在初始化... 
[2022-05-04 16:20:11] Action: "deploy" - Stage: "dev" - App: "sms-resender-api" - Name: "短信转发" 
[2022-05-04 16:20:12] 准备中... 
[2022-05-04 16:20:20] 上传中... 
[2022-05-04 16:20:21] 部署中... 
[2022-05-04 16:20:23] Error: 更新缓存代码失败: Invalid character in header content ["x-cos-copy-source"].[requestId: 8f39db3c-1917-491a-885e-98eb0d77ad8b, TraceId: deb4013c-7583-4605-a616-3163ba93d723]
[2022-05-04 16:20:23]     at processTencentAPIResponse (/usr/pnpm-global/4/node_modules/.pnpm/@serverless/platform-client-china@2.4.2/node_modules/@serverless/platform-client-china/src/api.js:73:19)
[2022-05-04 16:20:23]     at Object.run (/usr/pnpm-global/4/node_modules/.pnpm/@serverless/platform-client-china@2.4.2/node_modules/@serverless/platform-client-china/src/api.js:195:12)
[2022-05-04 16:20:23]     at process._tickCallback (internal/process/next_tick.js:68:7)
[2022-05-04 16:20:23] 
[2022-05-04 16:20:23] 
[2022-05-04 16:20:23] x deploy 失败 (12s)
[2022-05-04 16:20:23] 
[2022-05-04 16:20:23] 帮助文档:    https://cn.serverless.com/framework/docs
[2022-05-04 16:20:23] BUG提交:     https://github.com/serverless/serverless-tencent/issues
[2022-05-04 16:20:23] 问答社区:    https://github.com/serverless/serverless-tencent/discussions
[2022-05-04 16:20:23] 
[2022-05-04 16:20:23] Error:
[2022-05-04 16:20:23] 实例部署失败(Serverless:Engine)
[2022-05-04 16:20:23] 错误信息: 更新缓存代码失败: Invalid character in header content .
[2022-05-04 16:20:23] 
[2022-05-04 16:20:23] Environment: linux, node v10.21.0, tencent v3.21.6
[2022-05-04 16:20:23] RequestId:   8f39db3c-1917-491a-885e-98eb0d77ad8b
[2022-05-04 16:20:23] TraceId:     deb4013c-7583-4605-a616-3163ba93d723
[2022-05-04 16:20:23] 
[2022-05-04 16:20:26] 
script returned exit code 1

调试信息:

已上传

环境版本 已上传

serverless.yml 配置 ``` [2022-05-04 16:20:09] org: '${env:TENCENT_APP_ID}' [2022-05-04 16:20:09] app: '${env:APP_NAME}' [2022-05-04 16:20:09] stage: '${env:STAGE}' [2022-05-04 16:20:09] component: flask [2022-05-04 16:20:09] name: '${env:INSTANCE_NAME}' [2022-05-04 16:20:09] inputs: [2022-05-04 16:20:09] src: ./ [2022-05-04 16:20:09] name: sms_resender_api [2022-05-04 16:20:09] namespace: default [2022-05-04 16:20:09] type: web [2022-05-04 16:20:09] entryFile: [app.py](http://app.py/) [2022-05-04 16:20:09] region: '${env:REGION}' [2022-05-04 16:20:09] runtime: '${env:RUNTIME}' [2022-05-04 16:20:09] description: 短信转发API [2022-05-04 16:20:09] timeout: '300' [2022-05-04 16:20:09] publicAccess: true [2022-05-04 16:20:09] events: [2022-05-04 16:20:09] apigw: [2022-05-04 16:20:09] parameters: [2022-05-04 16:20:09] serviceName: sms_resender_api [2022-05-04 16:20:09] protocols: [2022-05-04 16:20:09] - https [2022-05-04 16:20:09] description: 短信转发主api [2022-05-04 16:20:09] environment: release [2022-05-04 16:20:09] endpoints: [2022-05-04 16:20:09] - path: / [2022-05-04 16:20:09] method: ANY ```

DEBUG 输出 ```yml # 添加环境变量 SLS_DEBUG=* 并重新执行命令,然后复制命令以及控制台输出粘贴在这里。 ```

额外信息

zongUMR commented 2 years ago

@wx2020 感谢反馈,我们会调查一下此问题,相关进度会在这里更新。

zongUMR commented 2 years ago

@wx2020 您这边再试一次? 我在联系腾讯云的技术支持,暂时还没回复。不过我这里本地是没法复现您的问题的,有可能是是偶现问题,所以希望您可以再试一次。谢谢

wx2020 commented 2 years ago

@zongUMR 问题解决了,问题原因在于 serverless.yml 的 app 配置项使用了中文,修改为英文后问题消失

 org: '${env:TENCENT_APP_ID}'
 app: '${env:APP_NAME}' // 使用了中文