Giter VIP home page Giter VIP logo

faas's Introduction

Steps

  • lpf init // inti project
  • lpf login // login to site
  • lpf get functions // get list of functions
  • lpf pull [faas function name] // pull function in functions folder, secrets in settings.json
  • NOTE: use LP faas UI to create secret so lpf can download in correct format, this can be used for local dev
  • lpf invoke [function name] -l // invoke local instance with -l
  • lpf push [function name] // push to account
  • lpf deploy [fun]tion name // deploy to account

To create new faas function

use lpf init

snippets

They are in .vscode/faas-snippets.code-snippets

use snippets in vscode

in a js file, F1, search snippet or code snippet

Check lpf is working

use lpf get functions

you should get login prompts and then it should diplay list of functions

or

lpf login -a 90412079 -u [email protected] -p pwd

local developmernt

install lpf

lpf init // init project

you need to do this to install snippets

cd to functions folder

lpf pull 'faas function name' to pull it from the account

the project folder convention is functions[function folder]\index.js and config.json

to invoke a funciton do functions\function name, it going to get index.js and config.json

  • terminal in faas folder, 1 level above functions[function name] folder
  • do lpf invoke [function name] -l (-l for local)

use settings.json to include parameters

  • including secrets
  • do not include sensitive data init
  • add sensitive data in settings.json.local for local dev

TODO example

TO Debug in VSCcode (can't get it working)

Preparation for Debugging It's necessary to run the lpf init command to initialize the project structure and to install all required packages for the local faas-toolbelt.

To get started with the local development and debugging some preparation is needed:

Local secrets and whitelisting can be stored in the settings.json Local environment variables and input can be stored in the config.json in the functions folder The Debugger will use a mocked faas-toolbelt To have access to the LivePerson services it's necessary to be logged in or set an environment variable called BRAND_ID with your accountId Example with BRAND_ID and debug command: BRAND_ID=123456789 lpf debug TestFunction Debugging with VSC Set a breakpoint in your desired function. Run the debugger (two options available) lpf debug Open command palette -> Tasks: Run Task -> Debug Function Run Attach FaaS Debugger from the launch.json. The debugger will start and pause at the auto-generated code. Use IntelliJ debugger to navigate through your code.

Tips

  • you can set config.json and invoke the deployed version in the cloud with local config.json
  • use console.info("debug message"); it will be part of the result payload
{
    "result": "Hello Worldundefined",
    "logs": [
        {
            "level": "Info",
            "message": "debug message",
            "extras": [],
            "timestamp": 1664568751806
        }
    ]
}

faas's People

Contributors

wlai-partner avatar

Watchers

 avatar

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.