Closed pasicopan closed 2 years ago
这个问题我也遇到了,我使用github的workflow也是报一样的提示 @ole3021
@pasicopan @lyd0
从 Serverless 3.0+
之后,我们就不再集成和使用 @serverless/components
这个包了,改为使用当前的serverless-tencent CLI
,您可以使用以下两种方法:
npm install -g serverless
, 然后直接sls deploy
即可,CLI 会自动下载 serverless-tencent CLI
的二进制版本 然后进行部署npm i -g serverless serverless-tencent
, 然后执行sls deploy
即可, 这样serverless CLI
会探测到已经npm安装了serverless-tencent CLI
进行项目部署都试过了,都不行,报同样的错误
+ serverless@3.2.1
+ serverless-tencent@3.20.2
added 387 packages from 235 contributors and updated 2 packages in 61.771s
# sls deploy
Serverless Components CLI is no longer bundled with Serverless Framework CLI
To run it, ensure it's installed:
npm install -g @serverless/components
Then run:
components <command> <options>
@pasicopan @lyd0 从
Serverless 3.0+
之后,我们就不再集成和使用@serverless/components
这个包了,改为使用当前的serverless-tencent CLI
,您可以使用以下两种方法:
npm install -g serverless
, 然后直接sls deploy
即可,CLI 会自动下载serverless-tencent CLI
的二进制版本 然后进行部署npm i -g serverless serverless-tencent
, 然后执行sls deploy
即可, 这样serverless CLI
会探测到已经npm安装了serverless-tencent CLI
进行项目部署
@pasicopan 您的项目在本地可以部署吗?
@pasicopan 您试一下添加一个环境变量 SERVERLESS_PLATFORM_VENDOR=tencent sls deploy
本地macbook pro可以的,而且只需要安装npm i -g serverless
➜ xxx git:(feat/serverless) sls -v
Framework Core: 3.2.1
Plugin: 6.0.0
SDK: 4.3.1
Tencent CLI: 3.20.2 (binary)
➜ xxx git:(feat/serverless) sls deploy
请扫码进行登陆,或通过 sls credentials 配置全局用户授权,详情请查看 sls --help
请使用微信扫描上方二维码或者点击下方链接登录
https://slslogin.qcloud.com/xxx
腾讯云 登录成功
serverless ⚡tencent
Action: "deploy" - Stage: "dev" - App: "ctb-9612f300" - Name: "ctb-front-2"
region: ap-guangzhou
website: https://xxx.cos-website.ap-guangzhou.myqcloud.com
应用控制台: https://serverless.cloud.tencent.com/apps/xxx/dev
另外,在macbookpro 里面的docker 也是失败的,基于node:14-buster 的镜像,报的错和jenkins 的一样。怀疑这个工具不兼容某些linux 系统?
@pasicopan 您的项目在本地可以部署吗?
@pasicopan 您试一下添加一个环境变量
SERVERLESS_PLATFORM_VENDOR=tencent sls deploy
@pasicopan @lyd0 请试一下这 个方法
@pasicopan @lyd0 上面这个Serverless Components CLI is no longer bundled with Serverless Framework CLI
错误是说的全球版本的 Components CLI 已经不在集成在 Serverless 的CLI里面了,需要单独安装使用。如果您使用的是腾讯云和国内的Serverless 环境的话 应该是判断逻辑没有自动关联到新的 Tencent CLI,可以使用以下两个方式来解决:
在组件的项目根目录(有 serverless.yml 配置文件的地方)执行 sls deploy
这样 Serverless Framework CLI 会自动调用 Tencent CLI 来完成应用的部署。
在执行命令时添加环境变量 SLS_GEO_LOCATION=cn sls deploy
或 SERVERLESS_PLATFORM_VENDOR=tencent sls deploy
来指定为中国环境或腾讯云,也可以将命令传递给 Tencent CLI 来完成部署。
更多 CLI 的高级使用说明请参考:https://cn.serverless.com/framework/docs-guides-cli-advance#%E5%88%87%E6%8D%A2-cli
这里解释一下这次 Serverless CLI v3 升级的改动。
主要是减少了代码包的体积,并优化了使用体验。
这是 Serverless Framework CLI v2 的简要结构:
- Serverless CLI V2
- Components CLI (For Global & Tencent) 随着 这部分代码越来越复杂,导致下载,安装,执行命令过慢。
这是 Serverless Framework CLI v3 的简要结构:
- Serverless CLI V3
- Tencent CLI (For Tencent Only, Tencent CLI 会根据需要自动安装并调用)
Tencent CLI 的调用默认会在应用目录下执行命令时,或在中国时区的系统中执行命令时自动调用,此外也可以按照文档的方式,通过环境变量制定调用。
同时将海外的 components 使用的CLI 单独拆分了出去 (仅供在海外云厂商(如 AWS)使用 Serverless Components 部署应用的用户下载使用)。
- Components CLI (For Global Only)
好的 谢谢你!
@pasicopan 您试一下添加一个环境变量
SERVERLESS_PLATFORM_VENDOR=tencent sls deploy
@pasicopan @lyd0 请试一下这 个方法
@pasicopan 您试一下添加一个环境变量
SERVERLESS_PLATFORM_VENDOR=tencent sls deploy
macbook 的docker 可以了,但jenkins 的不可以
x deploy 失败 (91s)
帮助文档: https://cn.serverless.com/framework/docs
BUG提交: https://github.com/serverless/serverless-tencent/issues
问答社区: https://github.com/serverless/serverless-tencent/discussions
Error:
上传代码失败
错误信息: Cannot read property 'Error' of undefined
Environment: linux, node v14.0.0, tencent v3.20.2[G
[G[?25hBuild step 'Execute shell' marked build as failure
Finished: FAILURE
@pasicopan 您试一下添加一个环境变量
SERVERLESS_PLATFORM_VENDOR=tencent sls deploy
macbook 的docker 可以了,但jenkins 的不可以
x deploy 失败 (91s) 帮助文档: https://cn.serverless.com/framework/docs BUG提交: https://github.com/serverless/serverless-tencent/issues 问答社区: https://github.com/serverless/serverless-tencent/discussions Error: 上传代码失败 错误信息: Cannot read property 'Error' of undefined Environment: linux, node v14.0.0, tencent v3.20.2�[G �[G�[?25hBuild step 'Execute shell' marked build as failure Finished: FAILURE
出现这个错误说明已经正确的被CLI 工具进行部署了,但是部署流程出了错误。 docker和jenkins部署的相同的代码吗? 您可以再尝试部署一次,或者提供一个最小的错误复现代码或者步骤。 因为正常来说您使用的是相同的工具版本和项目代码的话,应该是都会成功的
jenkins node 版本从14.0.0 降到12.22.7 后成功了。
步骤1:node 选择14.0.0,失败; 步骤2:node 选择12.22.7,成功; 步骤3:node 选择14.0.0,再次失败;
@pasicopan Serverless CLI 在 node 12 和 node 14 我们的测试中都是可以正常工作的,可以麻烦提供一下 node 14 的复现步骤吗? 以便我们跟进检查。 同时也希望可以在本地使用 node 14 测试是否 Serverless CLI 对node 14兼容有问题。 非常感谢。
另外 我看到这你这里有安装 @serverless/components
同时你这里使用的是 website 的组件, 这里没有必要安装 @serverless/components
, 你这里只需要在部署的时候指定环境(SERVERLESS_PLATFORM_VENDOR=tencent sls deploy
) 或者在项目目录(有 serverless.yml) 的地方执行 sls deploy
就可以。
相同的问题,环境变量加了也没有效果(本地 macOS 12.3、node 14 设置环境变量后有效),github action 无效。
相关环境:
github action:
Run actions/setup-node@v2
Found in cache @ /opt/hostedtoolcache/node/12.22.12/x64
/opt/hostedtoolcache/node/12.22.12/x64/bin/npm config get cache
/home/runner/.npm
Received 253767[9](https://github.com/ahaclub/github-webhook-feishu/runs/6634447032?check_suite_focus=true#step:4:10)5 of 25376795 ([10](https://github.com/ahaclub/github-webhook-feishu/runs/6634447032?check_suite_focus=true#step:4:11)0.0%), 71.2 MBs/sec
Cache Size: ~24 MB (25376795 B)
/usr/bin/tar --use-compress-program zstd -d -xf /home/runner/work/_temp/64d46c65-7a90-40f7-9166-32d8508938a6/cache.tzst -P -C /home/runner/work/github-webhook-feishu/github-webhook-feishu
Cache restored successfully
Cache restored from key: node-cache-Linux-npm-64a3e519064643701956c80645343a4bf472f1f9a626dec0220add7d79ae2461
1s
Run npm install
npm WARN express-demo@1.0.0 No repository field.
added 50 packages from 37 contributors and audited 50 packages in 0.734s
found 0 vulnerabilities
26s
Run npm i -g serverless serverless-tencent
npm WARN deprecated querystring@0.2.1: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
npm WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
npm WARN deprecated uuid@3.3.2: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
npm WARN deprecated superagent@3.8.3: Please upgrade to v7.0.2+ of superagent. We have fixed numerous issues with streams, form-data, attach(), filesystem errors not bubbling up (ENOENT on attach()), and all tests are now passing. See the releases tab for more information at <https://github.com/visionmedia/superagent/releases>.
npm WARN deprecated formidable@1.2.6: Please upgrade to latest, formidable@v2 or formidable@v3! Check these notes: https://bit.ly/2ZEqIau
npm WARN deprecated uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
/opt/hostedtoolcache/node/12.22.12/x64/bin/slt -> /opt/hostedtoolcache/node/12.22.12/x64/lib/node_modules/serverless-tencent/bin/serverless-tencent
/opt/hostedtoolcache/node/12.22.12/x64/bin/serverless-tencent -> /opt/hostedtoolcache/node/12.22.12/x64/lib/node_modules/serverless-tencent/bin/serverless-tencent
/opt/hostedtoolcache/node/12.22.12/x64/bin/serverless -> /opt/hostedtoolcache/node/12.22.12/x64/lib/node_modules/serverless/bin/serverless.js
/opt/hostedtoolcache/node/12.22.12/x64/bin/sls -> /opt/hostedtoolcache/node/12.22.12/x64/lib/node_modules/serverless/bin/serverless.js
> snappy@6.3.5 install /opt/hostedtoolcache/node/12.22.12/x64/lib/node_modules/serverless-tencent/node_modules/snappy
> prebuild-install || node-gyp rebuild
> protobufjs@6.11.3 postinstall /opt/hostedtoolcache/node/12.22.12/x64/lib/node_modules/serverless-tencent/node_modules/protobufjs
> node scripts/postinstall
> es5-ext@0.10.61 postinstall /opt/hostedtoolcache/node/12.22.12/x64/lib/node_modules/serverless-tencent/node_modules/es5-ext
> node -e "try{require('./_postinstall')}catch(e){}" || exit 0
> es5-ext@0.10.61 postinstall /opt/hostedtoolcache/node/12.22.12/x64/lib/node_modules/serverless/node_modules/es5-ext
> node -e "try{require('./_postinstall')}catch(e){}" || exit 0
> serverless@3.18.2 postinstall /opt/hostedtoolcache/node/12.22.12/x64/lib/node_modules/serverless
> node ./scripts/postinstall.js
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.3.2 (node_modules/serverless/node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.3.2 (node_modules/serverless-tencent/node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
+ serverless@3.18.2
+ serverless-tencent@3.21.6
added 817 packages from 399 contributors in 25.446s
0s
Run serverless credentials set --secretId *** --secretKey ***
Serverless Components CLI is no longer bundled with Serverless Framework CLI
To run it, ensure it's installed:
npm install -g @serverless/components
Then run:
components <command> <options>
0s
Run export SERVERLESS_PLATFORM_VENDOR=tencent sls deploy
export SERVERLESS_PLATFORM_VENDOR=tencent sls deploy
shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
0s
Run export SLS_GEO_LOCATION=cn sls deploy
export SLS_GEO_LOCATION=cn sls deploy
shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
0s
Run sls deploy
Serverless Components CLI is no longer bundled with Serverless Framework CLI
To run it, ensure it's installed:
npm install -g @serverless/components
Then run:
components <command> <options>
0s
Post job cleanup.
/opt/hostedtoolcache/node/12.22.12/x64/bin/npm config get cache
/home/runner/.npm
Cache hit occurred on the primary key node-cache-Linux-npm-64a3e5[1](https://github.com/ahaclub/github-webhook-feishu/runs/6634447032?check_suite_focus=true#step:5:1)906[4](https://github.com/ahaclub/github-webhook-feishu/runs/6634447032?check_suite_focus=true#step:5:5)6437019[5](https://github.com/ahaclub/github-webhook-feishu/runs/6634447032?check_suite_focus=true#step:5:6)[6](https://github.com/ahaclub/github-webhook-feishu/runs/6634447032?check_suite_focus=true#step:5:7)c80645343a4bf4[7](https://github.com/ahaclub/github-webhook-feishu/runs/6634447032?check_suite_focus=true#step:5:8)2f[1](https://github.com/ahaclub/github-webhook-feishu/runs/6634447032?check_suite_focus=true#step:6:1)f9a626dec0220add7d79ae2[4](https://github.com/ahaclub/github-webhook-feishu/runs/6634447032?check_suite_focus=true#step:6:5)[6](https://github.com/ahaclub/github-webhook-feishu/runs/6634447032?check_suite_focus=true#step:6:7)[1](https://github.com/ahaclub/github-webhook-feishu/runs/6634447032?check_suite_focus=true#step:7:1), not saving cache.
BUG 描述:
jenkins(Jenkins 2.235.3) 配置全局nodejs 包
npm i -g serverless @serverless/components
后 构建项目运行sls deploy
失败,提示如下复现步骤:
serverless @serverless/components
sls deploy
预期结果:
deploy success
实际结果:
调试信息:
环境版本
```yaml - 操作系统(OS): Linux Dm-jenkins-C-S1 3.10.0-1062.1.2.el7.x86_64 - Node 版本: 12.22.7 - Components: 3.18.2 - Framework: 3.2.1 - SDK 版本: 4.3.1 - Plugin: 6.0.0 ```serverless.yml 配置
```yaml component: website name: abc-front-2 app: abc-9612f300 inputs: src: src: ./src hook: npm run build:test dist: ./dist bucketName: abc-front protocol: https ```