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

函数间调用,tencentcloud-serverless-nodejs包的rigion为undefined #2

Open
klmhly opened this issue Feb 25, 2020 · 4 comments
Open
Assignees

Comments

@klmhly
Copy link

klmhly commented Feb 25, 2020

TypeError: Cannot read property 'region' of undefined
at SDK.default_1 [as invoke] (/var/user/node_modules/tencentcloud-serverless-nodejs/dist/services/invoke.js:14:32)

@klmhly
Copy link
Author

klmhly commented Feb 25, 2020

这是node_modules/tencentcloud-serverless-nodejs/dist/services/invoke.js 文件的源码

第14行

const region = this.config.region;

哪里定义了this.config? 为什么会undefined

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const utils_1 = require("../helper/utils");
const _ = require("lodash");
async function default_1(params, extraParams) {
    if (!this.config)
        this.init({
            secretId: params.secretId,
            secretKey: params.secretKey,
            token: params.token,
            region: params.region
        }, extraParams);
    const requestHelper = this.requestHelper;
    const region = this.config.region;
    let __params = _.omitBy(_.merge({
        region,
        namespace: 'default',
        qualifier: '$LATEST'
    }, {
        functionName: params.functionName,
        qualifier: params.qualifier,
        clientContext: params.data,
        namespace: params.namespace,
        region: params.region || this.config.region,
        secretId: params.secretId || this.config.secretId,
        token: params.token || this.config.token
    }, {
        invocationType: 'RequestResponse',
        logType: 'Tail',
        version: '2018-04-16',
        action: 'Invoke'
    }), _.isUndefined);
    return await utils_1.uniteRes(requestHelper, this, [
        utils_1.caseForObject(__params, 'upper'),
        {
            serviceType: 'scf',
            secretKey: params.secretKey || this.config.secretKey
        },
        this.extraParams || extraParams
    ], 'Response.Result.RetMsg');
}
exports.default = default_1;

@jy1989
Copy link

jy1989 commented Jun 10, 2020

同样的错误。。。 还看了我半天- -

@ycp424c
Copy link

ycp424c commented Jun 12, 2020

近期内这个包会在新项目中重构,目前可先用云api的sdk调用invoke接口,参考资料
https://www.npmjs.com/package/tencentcloud-sdk-nodejs
https://cloud.tencent.com/document/api/583/17243

@ycp424c
Copy link

ycp424c commented Jun 16, 2020

https://github.com/tencentyun/tencentcloud-serverless-nodejs
此sdk在这里重构了,npm更新了大版本

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants