小编Vin*_*ius的帖子

如何在无服务器离线状态下运行 Lambda Docker

我想serverless offline使用指向 Docker 映像的 Lambda 函数来运行。

当我尝试运行时serverless offline,我只是收到:

Offline [http for lambda] listening on http://localhost:3002
Function names exposed for local invocation by aws-sdk:
           * hello-function: sample-app3-dev-hello-function
Run Code Online (Sandbox Code Playgroud)

如果我尝试访问http://localhost:3002/hello,会返回404错误


serverless.yml

Offline [http for lambda] listening on http://localhost:3002
Function names exposed for local invocation by aws-sdk:
           * hello-function: sample-app3-dev-hello-function
Run Code Online (Sandbox Code Playgroud)

app/myfunction.py

service: sample-app3
frameworkVersion: '3'

plugins:
  - serverless-offline

provider:
  name: aws
  ecr:
    images:
      sampleapp3image:
        path: ./app/
        platform: linux/amd64

functions:
  hello-function:
    image:
      name: sampleapp3image
    events:
      - httpApi:
          path: /hello
          method: GET …
Run Code Online (Sandbox Code Playgroud)

serverless-framework serverless-offline

6
推荐指数
1
解决办法
3776
查看次数