Release Notes
Announcements
/tmp directory, and other directories are read-only. Therefore, you need to install, package and upload the local dependent library for use. The Node.js dependency package can be uploaded with function codes to the cloud, or uploaded to the layer that will be bound to the required function.npm install xxx command in the code directory to install dependencies.index.js code file shown below to install the requests dependency locally.'use strict';var request = require('request');exports.main_handler = async (event, context) => {request('https://cloud.tencent.com/', function (error, response, body) {if (!error && response.statusCode == 200) {console.log(body) // Processing logic for successful request}})return "success"};
npm install request command to install the requests dependency under the current directory of the project.require statement in function codes. You can also package and deploy dependencies to a layer, and bind the layer to a function being created to reuse them.Apakah halaman ini membantu?
Anda juga dapat Menghubungi Penjualan atau Mengirimkan Tiket untuk meminta bantuan.
masukan