mthenw / serverless-go-plugin

⚡️ Serverless Framework plugin that compiles Go functions on the fly. Sponsored by https://cloudash.dev
https://cloudash.dev
MIT License
103 stars 17 forks source link

Invoking function locally failed due to docker pull failed #59

Closed hirenchauhan2 closed 1 month ago

hirenchauhan2 commented 1 month ago

Hi, I was exploring this plugin to deploy my go code in aws lambda with serverless. But this is not working due to the docker image issues. I'm unable to invoke the functions locally.

Here's output of local invoke call:

➜ npx sls invoke local -f ping                                                            
Go Plugin: Compilation time (ping): 141 ms
Environment: linux, node 18.19.0, framework 3.39.0 (local), plugin 7.2.3, SDK 4.5.1
Credentials: Local, "default" profile
Docs:        docs.serverless.com
Support:     forum.serverless.com
Bugs:        github.com/serverless/serverless/issues

Error:
Error: `docker pull --disable-content-trust=false lambci/lambda:go1.x` Exited with code 1
    at ChildProcess.<anonymous> (/home/hiren/dev/work/go-helper-functions/node_modules/child-process-ext/spawn.js:38:8)
    at ChildProcess.emit (node:events:517:28)
    at ChildProcess.emit (node:domain:489:12)
    at maybeClose (node:internal/child_process:1098:16)
    at ChildProcess._handle.onexit (node:internal/child_process:303:5)

When I tried to pull the docker image, this is what I got:

➜ docker pull --disable-content-trust=false lambci/lambda:go1.x
time="2024-10-05T21:43:06+05:30" level=error msg="Metadata for targets expired"
time="2024-10-05T21:43:10+05:30" level=error msg="Metadata for targets expired"
Error: remote repository docker.io/lambci/lambda out-of-date: targets expired at Mon Jan 29 16:32:58 -0500 2024

Here's my serverless.yml:


service: go-helper-functions
configValidationMode: error

plugins:
  - serverless-go-plugin
  - serverless-prune-plugin

provider:
  name: aws
  region: us-west-2
  runtime: go1.x

functions:
  ping:
    handler: ./handlers/ping/main.go

Note that, the function was compiled successfully and even got the package step done successfully.

This is my folder structure for the project(not sure if this is useful!) image

hirenchauhan2 commented 1 month ago

Sorry I think this is not your issue. It's mostly an issue on the serverless framework itself I guess. I'll file this issue there as well.