amazon-web-services - 如何在 lambda 中使用 axios?

标签 amazon-web-services aws-lambda axios alexa alexa-skills-kit

我是否必须在本地安装 axios 模块,然后将其部署到 lambda,或者是否有办法通过内联代码编辑器以及在浏览器中进行操作?

最佳答案

您可以使用 axios 包发布一个简单的 Node.js AWS Lambda 层,然后将创建的层附加到您的 lambda。
为层创建 .zip 文件的命令列表:

mkdir nodejs
cd nodejs
npm i axios
rm -rf package-lock.json
cd ..
zip -r axios.zip nodejs
此命令列表取自本文
https://ljmocic.medium.com/publish-simple-node-js-aws-lambda-layer-a87c00afdd83
创建图层
enter image description here
采用层 ARN
enter image description here
将层附加到 Lambda
enter image description here

关于amazon-web-services - 如何在 lambda 中使用 axios?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48356841/

相关文章:

ios - 将规则添加到 S3BucketLifecycleConfiguration

amazon-web-services - 名称为 ExRole 的导出已由堆栈 Root-role 导出

javascript - 到Firebase-Cloud-Function Endpoint的发布请求时收到“500 Internal Server Error”

javascript - axios 的 DefinelyTyped 问题

reactjs - Express/React 与 CORS - 为 React SPA 设置仅 HTTP 的安全 Cookie

amazon-web-services - CodeDeploy 管道未找到 AppSpec.yml - 但显然可用

amazon-web-services - Amazon elasticsearch 对 FreeStorageSpace 指标的解释

python - Boto3 S3 列表对象在 AWS lambda 中抛出错误

aws-lambda - 由于一些神秘的错误消息,无法创建 aws lambda 函数

node.js - 如何确保 Lambda 函数等待使用 wait 调用异步函数?