tencent cloud

フィードバック

Online Dependency Installation

最終更新日:2023-03-14 15:54:10

    Overview

    Tencent Cloud SCF supports online dependency installation during function deployment.

    Features

    Note:

    Online dependency installation is supported only for Node.js.

    If Online install dependency is enabled in the function configuration, each time the code is uploaded, the SCF backend will check the package.json file in the root directory of the code package and try using npm install to install the dependencies based on the dependencies in package.json.

    For example, if the package.json file in the project lists the following dependency:

    {
          "dependencies": {
          "lodash": "4.17.15"
        }
    }
    

    Then this dependency will be imported into the function during the deployment:

    const _ = require('lodash');
    exports.handle = (event, context, callback) => {
        _.chunk(['a', 'b', 'c', 'd'], 2);
        // => [['a', 'b'], ['c', 'd']]
    };
    

    Directions

    1. Log in to the SCF console and select Guangzhou as the region.
    2. Select Functions on the left sidebar and locate the target function.
    3. Select the Function codes tab and modify the function code as needed.
    4. In the top-right corner of the IDE code editing window, click and select Automatic dependency installation: disable in the drop-down list to enable automatic dependency installation as shown below:

      After enabling online installation, refresh the page. In the bottom right corner of the code editing page, click Switch to Old Editor. In Upload method, select Online install dependency.
    5. Click Deploy, and SCF will automatically install dependencies according to package.json.
    お問い合わせ

    カスタマーサービスをご提供できるため、ぜひお気軽にお問い合わせくださいませ。

    テクニカルサポート

    さらにサポートが必要な場合は、サポートチケットを送信して弊社サポートチームにお問い合わせください。24時間365日のサポートをご提供します。

    電話サポート(24 時間365日対応)