softprops / serverless-rust

⚑ πŸ¦€ a serverless framework plugin for rustlang applications
https://www.npmjs.com/package/serverless-rust
MIT License
548 stars 82 forks source link

Function Not Found - basic-rust-lambda-dev-hello #62

Closed JimLynchCodes closed 4 years ago

JimLynchCodes commented 4 years ago

πŸ› Bug description

Describe your issue in detail.

When I scaffold a fresh project with npx serverless install \ --url https://github.com/softprops/serverless-aws-rust-http \ --name my-new-api then run npm i and then try to invoke locally:

npx serverless invoke -f hello -d "$(cat payload.json)"

It gives me the error, "Function not found".

Serverless Error ---------------------------------------

  Function not found: arn:aws:lambda:us-east-1:954459734159:function:basic-rust-lambda-dev-hello

  Get Support --------------------------------------------
     Docs:          docs.serverless.com
     Bugs:          github.com/serverless/serverless/issues
     Issues:        forum.serverless.com

  Your Environment Information ---------------------------
     OS:                     darwin
     Node Version:           11.15.0
     Serverless Version:     1.47.0

Screen Shot 2020-01-26 at 11 40 56 AM

πŸ€” Expected Behavior

It should have found the function hello.

πŸ‘Ÿ Steps to reproduce

(described above)

🌍 Your environment

serverless version: 1.47.0

rust-plugin version: 0.3.6 Node Version: 11.15.0 OS: darwin

JimLynchCodes commented 4 years ago

Example project here - > https://github.com/JimLynchCodes/Basic-Rust-Lambda

Thanks! πŸ™

brainstorm commented 4 years ago

What does sls deploy say?

JimLynchCodes commented 4 years ago

hmm not sure if I deployed it actually.

I don't want to deploy it yet though- I just want to invoke it locally. Is there a recommended way to do that?

Thanks! ❀️

brainstorm commented 4 years ago

According to README.md, passing local keyword on the npx cmdline:

https://github.com/softprops/serverless-rust#invoke-your-lambdas-locally

You don't seem to be doing that AFAICT?

JimLynchCodes commented 4 years ago

Thank you @brainstorm. I am still having issues though.

  1. I cloned the repo again
  2. I ran npm i
  3. I run the invoke script including local:
    npx serverless invoke local -f hello -d "$(cat local-invoke-payload.json)"

But I am still getting errors about docker for some reason:

   β”‚                                                                β”‚
   β”‚      New minor version of npm available! 6.12.1 β†’ 6.13.7       β”‚
   β”‚   Changelog: https://github.com/npm/cli/releases/tag/v6.13.7   β”‚
   β”‚               Run npm install -g npm to update!                β”‚
   β”‚                                                                β”‚
   ╰────────────────────────────────────────────────────────────────╯

basic-rust-lambda (master) β™˜ npx serverless invoke local -f hello -d "$(cat local-invoke-payload.json)"
Serverless: Building native Rust hello func...
docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?.
See 'docker run --help'.
Serverless: Dockerized Rust build encountered an error: undefined 125.

  Error --------------------------------------------------

     For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.

  Get Support --------------------------------------------
     Docs:          docs.serverless.com
     Bugs:          github.com/serverless/serverless/issues
     Issues:        forum.serverless.com

  Your Environment Information ---------------------------
     OS:                     darwin
     Node Version:           12.13.1
     Serverless Version:     1.47.0

Maybe I need to update versions of something?

I am really interested in building lambda functions with Rust so I'm very keen on getting this working! Thanks! πŸ™β€οΈ

brainstorm commented 4 years ago

docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?.... your docker daemon doesn't seem to be running.

JimLynchCodes commented 4 years ago

@brainstorm Can you please elaborate?

What is the command to start the docker daemon running for this project?

If it is necessary, can we please add it to the README?

JimLynchCodes commented 4 years ago

@brainstorm ?

JimLynchCodes commented 4 years ago

πŸ™ƒ

softprops commented 4 years ago

Hi folks sorry for the delayed response. @JimLynchCodes I tried my best to catch and add useful logging on the case I think we were hitting. The docker daemon was not running. It is needed for the default build for this plugin but also by serverless itself for locally invoking functions on the aws provided runtime.

Of note I'm currently publishing a release for experimental local builds - https://github.com/softprops/serverless-rust#-experimental-local-builds you might want to try this out if docker is becoming a hassle.

Closing the this issue because both reported outcomes were expected behavior for invoking a remote lambda without deploying and invoking locally without a running docker daemon