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.

Invoke local doesn't work with individually packaging.

See original GitHub issue

Are you certain it’s a bug?

  • Yes, it looks like a bug

Is the issue caused by a plugin?

  • It is not a plugin issue

Are you using the latest version?

  • Yes, I’m using the latest version

Is there an existing issue for this?

  • I have searched existing issues, it hasn’t been reported yet

Issue description

Probably the same issue as: https://github.com/serverless/serverless/issues/8729

Looks like the previous issue was addressed by PR but it still doesn’t work for me.

Service configuration (serverless.yml) content

service: xyz

frameworkVersion: '2'

provider:
  name: aws
  runtime: java8
  lambdaHashingVersion: 20201221

package:
  individually: true

functions:
  downloader:
    handler: xyz
    package:
      artifact: xyz.jar
    events:
      - sqs: xyz

Command name and used flags

serverless invoke local -f downloader -p eventmock.json

Command output

Serverless Error ----------------------------------------
 
  Artifact undefined doesn't exists, please compile it first.
 
  Get Support --------------------------------------------
     Docs:          docs.serverless.com
     Bugs:          github.com/serverless/serverless/issues
     Issues:        forum.serverless.com

Environment information

Your Environment Information ---------------------------
     Operating System:          darwin
     Node Version:              17.0.1
     Framework Version:         2.67.0
     Plugin Version:            5.5.1
     SDK Version:               4.3.0
     Components Version:        3.18.1

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
pikinier20commented, Dec 2, 2021

Hello @pikinier20 - thanks a lot for reporting and sorry you’ve run into trouble. Did you confirm that artifact for your function was already built and is available? Could you also please share more details about the failure with SLS_DEBUG=* set?

Could you provide a minimal reproducible example that I could run on my side to investigate more?

Thanks in advance 🙇

Yes, the artifact is there. If I change packaging mode to default and provide artifact in top-level package clause, the local invocation works.

As for the debug output:

Serverless: Load command interactiveCli
Serverless: Load command config
Serverless: Load command config:credentials
Serverless: Load command config:tabcompletion
Serverless: Load command config:tabcompletion:install
Serverless: Load command config:tabcompletion:uninstall
Serverless: Load command create
Serverless: Load command install
Serverless: Load command package
Serverless: Load command deploy
Serverless: Load command deploy:function
Serverless: Load command deploy:list
Serverless: Load command deploy:list:functions
Serverless: Load command invoke
Serverless: Load command invoke:local
Serverless: Load command info
Serverless: Load command logs
Serverless: Load command metrics
Serverless: Load command print
Serverless: Load command remove
Serverless: Load command rollback
Serverless: Load command rollback:function
Serverless: Load command slstats
Serverless: Load command plugin
Serverless: Load command plugin
Serverless: Load command plugin:install
Serverless: Load command plugin
Serverless: Load command plugin:uninstall
Serverless: Load command plugin
Serverless: Load command plugin:list
Serverless: Load command plugin
Serverless: Load command plugin:search
Serverless: Load command config
Serverless: Load command config:credentials
Serverless: Load command upgrade
Serverless: Load command uninstall
Serverless: Load command login
Serverless: Load command logout
Serverless: Load command generate-event
Serverless: Load command test
Serverless: Load command dashboard
Serverless: Load command output
Serverless: Load command output:get
Serverless: Load command output:list
Serverless: Load command param
Serverless: Load command param:get
Serverless: Load command param:list
Serverless: Load command studio
Serverless: Skipping variables resolution with old resolver (new resolver reported no more variables to resolve)
Serverless: Invoke invoke:local
 
 Serverless Error ----------------------------------------
 
  ServerlessError: Artifact undefined doesn't exists, please compile it first.
      at AwsInvokeLocal.invokeLocalJava (/usr/local/lib/node_modules/serverless/lib/plugins/aws/invokeLocal/index.js:680:13)
 

Also, I’ll try to prepare the example.

0reactions
mattcjcommented, Aug 9, 2022

Any objection to me submitting a PR? I’ve basically taken what @pikinier20 submitted back in December and addressed the question raised in that pull request.

Read more comments on GitHub >

github_iconTop Results From Across the Web

sam build - AWS Serverless Application Model
Instructs AWS SAM to build a single resource declared in the AWS SAM template. The build artifacts for the specified resource will be...
Read more >
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 >
Understanding how packaged desktop apps run on Windows
In response to a file open command, the OS will open the file from the per-user, per-package location first. If this location doesn't...
Read more >
Deploy on Kubernetes - Docker Documentation
This instantiates images required to run the Kubernetes server as containers, and installs the /usr/local/bin/kubectl command on your machine.
Read more >
Publishing Extensions - Visual Studio Code
Packaging extensions. If you want to test an extension on your local install of VS Code or distribute an extension without publishing it...
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