首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >lambda用层调用本地

lambda用层调用本地
EN

Stack Overflow用户
提问于 2022-08-01 20:37:18
回答 1查看 119关注 0票数 0

我试图通过使用层缓存选项在本地测试lambda层,但无法使其工作,我使用sam cdk和python3。

在我的api/ lambda _layers/ function中,我有一个名为common.py容器的文件,这是一个简单的函数,我喜欢在我的lambda中共享它。

代码语言:javascript
复制
sam local invoke  createLocations --event api/events/create_location_event.json -t cdk/cdk.out/LocationsAPI.template.json --layer-cache-basedir  api/lambda_layers/common --force-image-build --docker-network lambda-local

虽然在我的app.py中我导入了“公共”,但我得到了

代码语言:javascript
复制
commonlayer8CAC0AFA is a local Layer in the template
Building image........................
"errorMessage": "Unable to import module 'app': No module named 'common'", "errorType": "Runtime.ImportModuleError", "stackTrace": []}```

is there any other solution than --layer-cache-basedir ?
EN

回答 1

Stack Overflow用户

发布于 2022-08-01 22:24:37

在sam命令中尝试--docker-volume-basedir选项。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/73199348

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档