Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Enhancement] Add engine declaration in tcb template #478

Closed
2 of 13 tasks
JaxsonWang opened this issue Aug 21, 2021 · 3 comments
Closed
2 of 13 tasks

[Enhancement] Add engine declaration in tcb template #478

JaxsonWang opened this issue Aug 21, 2021 · 3 comments
Labels
enhancement New feature or request

Comments

@JaxsonWang
Copy link

问题描述 | Describe the bug

升级 CloudBase 后端依赖后

前端求情数据接口反馈:

{
    "requestId": "6cc7a75aac6bb54b2319da32c8d24c54",
    "code": "INVOKE_FUNCTION_FAILED",
    "message": "Code: -1\nScfRequestId: aadd8369-0292-11ec-bc94-5a33530ece43\nError:\nReferenceError: TextEncoder is not defined\n    at Object.<anonymous> (/var/user/node_modules/whatwg-url/dist/encoding.js:2:21)\n    at Module._compile (internal/modules/cjs/loader.js:701:30)\n    at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)\n    at Module.load (internal/modules/cjs/loader.js:600:32)\n    at tryModuleLoad (internal/modules/cjs/loader.js:539:12)\n    at Function.Module._load (internal/modules/cjs/loader.js:531:3)\n    at Module.require (internal/modules/cjs/loader.js:637:17)\n    at require (internal/modules/cjs/helpers.js:22:18)\n    at Object.<anonymous> (/var/user/node_modules/whatwg-url/dist/url-state-machine.js:5:34)\n    at Module._compile (internal/modules/cjs/loader.js:701:30). For more information, please refer to https://docs.cloudbase.net/error-code/service.html"
}

问题网站 | Website URL

iiong.com

部署方式 | Deploy Type

  • 服务部署在哪里? | Where your waline deploy?
    • Vercel
    • CloudBase
    • Docker
    • VPS, Virtual Host
    • Other
  • 数据存储在哪里?| Where your comment data store?
@lizheming
Copy link
Collaborator

看了下这个应该是 JSDom 依赖的一个模块使用了较新的 API 导致的,你看下你的 Node 版本,Node >= 11 应该是没有这个问题的。

@JaxsonWang
Copy link
Author

已经咨询过工程师了给了如下答复:

1、首先这边由于scf的限制,已经存在的云函数是无法正常改变nodeJS的依赖版本的。

2、您这边可以在下次部署的时候将之前的云函数删除,之后指定对应的node环境进行一键部署。

3、目前这边是scf的限制,在已有的云函数的基础上,nodeJS的依赖版本暂时无法进行更改,非常抱歉


不过我懒得重装,删了函数新建函数指定高版本的 nodejs 确实可以了

建议在 tcb-starter 添加指定版本:

{
    "version": "2.0",
    "envId": "{{envId}}",
    "$schema": "https://framework-1258016615.tcloudbaseapp.com/schema/latest.json ",
    "framework": {
        "name": "waline",
        "plugins": {
            "node": {
                "use": "@cloudbase/framework-plugin-node",
                "inputs": {
                    "entry": "app.js",
                    "name": "waline",
                    "path": "/waline",
                    "runtime": "Nodejs12.16"
                }
            }
        }
    }
}

@Mister-Hope
Copy link
Member

感谢反馈

@Mister-Hope Mister-Hope added the enhancement New feature or request label Oct 30, 2021
@Mister-Hope Mister-Hope changed the title [BUG] [Enhancement] Add engine declaration in tcb template Oct 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants