GithubHelp home page GithubHelp logo

Comments (7)

jayair avatar jayair commented on July 29, 2024

Hmm that is weird. What version of serverless are you using?

from serverless-nodejs-starter.

andrewoh531 avatar andrewoh531 commented on July 29, 2024

You've left out webpack in your command.

e.g. you need to run serverless webpack invoke local --function hello

from serverless-nodejs-starter.

newbreedofgeek avatar newbreedofgeek commented on July 29, 2024

@andrewoh531 when I run serverless webpack invoke local --function hello I get Command "webpack invoke local" not found, Run "serverless so that does not work.

@jayair I'm using serverless version 1.8.0

from serverless-nodejs-starter.

jayair avatar jayair commented on July 29, 2024

@newbreedofgeek Can I see the full error?

from serverless-nodejs-starter.

newbreedofgeek avatar newbreedofgeek commented on July 29, 2024

@jayair there is not much error detail, when I run serverless webpack invoke local --function hello

I get:

  Serverless Error ---------------------------------------
 
     Command "webpack invoke local" not found, Run "serverless
     help" for a list of all available commands.
 
  Get Support --------------------------------------------
     Docs:          docs.serverless.com
     Bugs:          github.com/serverless/serverless/issues
 
  Your Environment Information -----------------------------
     OS:                 darwin
     Node Version:       6.10.3
     Serverless Version: 1.8.0

I have not made any changes after I cloned this project, I just clones it, ran npm install and then ran the above command. If I run serverless webpack invoke --function hello it works, but local does not work.

Actually what is the difference between the invoke and invoke local

from serverless-nodejs-starter.

fwang avatar fwang commented on July 29, 2024

Hi @newbreedofgeek, sorry for the confusion. Let me explain what the following commands do:

serverless invoke
serverless invoke local
serverless webpack invoke

The first 2 are built-in commands of Serverless Framework. The former serverless invoke runs your Lambda function remotely and serverless invoke local runs it locally.

(function (exports, require, module, __filename, __dirname) { export const hello = async (event, context, callback) => {
                                                              ^^^^^^
SyntaxError: Unexpected token export....
.....

The reason you got the above error earlier when you ran serverless invoke local --function hello was because Serverless Framework tried to run your Lambda function in es7 syntax without transpiling first. This is the expected behavior.

The tutorial uses this Serverless Framework plugin, serverless-webpack to handle transpile. The third command serverless webpack invoke is added on by the plugin. It will transpile the Lambda function, then invoke it locally. And serverless webpack invoke local is not a valid command.

from serverless-nodejs-starter.

newbreedofgeek avatar newbreedofgeek commented on July 29, 2024

@fwang great! tnx :)

from serverless-nodejs-starter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.