question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

sls invoke local --function not working for non Node.js functions with standalone

See original GitHub issue

Bug Report

Description

  1. What did you do?
  • I installed the test python3 AWS using: serverless create --template aws-python3 --units-assignment
  1. What happened?
  • I’m not able to run it locally but it works on AWS
  1. What should’ve happened?
  • it should run locally with sls invoke local --function start
  1. What’s the content of your serverless.yml file?
service: units-assignment

provider:
  name: aws
  runtime: python3.7
  region: eu-central-1
  # you can define service wide environment variables here
  #  environment:
  #    variable1: value1
  environment:
    APALEO_ID: 

# you can add packaging information here
# package:
#  include:
#    - include-me.py
#    - include-me-dir/**
#  exclude:
#    - exclude-me.py
#    - exclude-me-dir/**

functions:
  start:
    handler: handler.start
  1. What’s the output you get when you use the SLS_DEBUG=* environment variable (e.g. SLS_DEBUG=* serverless deploy)
/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/Resources/Python.app/Contents/MacOS/Python: can't open file '/snapshot/serverless/lib/plugins/aws/invokeLocal/invoke.py': [Errno 2] No such file or directory```

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:11 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
NARKOZcommented, Jul 22, 2020

This worked for me: serverless uninstall && npm install -g serverless

1reaction
adimangocommented, Mar 10, 2020

I’m facing the same issue from a different mac.

   Docs:          docs.serverless.com
     Bugs:          github.com/serverless/serverless/issues
     Issues:        forum.serverless.com
 
  Your Environment Information ---------------------------
     Operating System:          darwin
     Node Version:              12.13.1
     Framework Version:         1.66.0 (standalone)
     Plugin Version:            3.4.1
     SDK Version:               2.3.0
     Components Version:        2.22.3
 
Alexs-MacBook-Pro-2:test-l alexdimango$ sls invoke local --function hello
/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/Resources/Python.app/Contents/MacOS/Python: can't open file '/snapshot/serverless/lib/plugins/aws/invokeLocal/invoke.py': [Errno 2] No such file or directory

@medikoo @Jun711 did you find the reason?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Invoke Local - AWS Lambda - Serverless Framework
The invoke local command sets reasonable environment variables for the invoked function. All AWS specific variables are set to values that are quite...
Read more >
aws "serverless invoke local" fails to run when node_modules ...
The problem is whenever I try to run sls invoke local I got a error messages due to package not found. So, the...
Read more >
How to develop locally using serverless offline - Fauna
The plugin starts an HTTP server locally to handle request lifecycles and invoke handlers. Typically, this is run locally on a developer's ...
Read more >
serverless-offline/community - Gitter
and it's on the initial start up not actually trying to invoke a function ... node ./postinstall.js. Thank you for installing [35mEJS [0m:...
Read more >
Running and debugging AWS Lambda functions locally with ...
One of the complaints developers often have for AWS Lambda is the inability to run and debug functions locally. For Node.js at least,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found