Giter Club home page Giter Club logo

Comments (4)

rbren avatar rbren commented on July 18, 2024

What exactly are you trying to debug? I'm not familiar with VSCode, but a good old console.log inside of the handler should work.

from datafire.

vdurante avatar vdurante commented on July 18, 2024

I am trying to debug the execution of the handler. I know how to run it through command line, but using VSCODE (or any other IDE), I am able to debug step by step.

I found a "solution". I implemented a main that imports the action and calls the handler such as myaction.handler()

Mind if I make another question? Is there a way of chain multiple actions? For example: I have to import data from multiple hubspot accounts, so I create an action that gets as an input the api_key of that account and inserts the data in a database. Then, a second action that lists all the api_keys from a file, database, or DataFire accounts file, and for each key, runs the first action.

Thanks!

from datafire.

rbren avatar rbren commented on July 18, 2024

OK cool. FYI you can also use action.run(input, context), which will validate input and do some error handling.

You can absolutely chain actions together. If you're using async/await, that might look something like this:

const getHubspotAccounts = require('./get-hubspot-accounts');
const addAccountToDB = require('./add-account-to-db');
const datafire = require('datafire');

module.exports = new datafire.Action({
  handler: async (input, context) => {
    let accounts = await getHubspotAccounts.run({}, context);
    for (let account of accounts) {
      await addAccountToDB.run(account, context);
    }
    return `Added ${accounts.length} accounts`;
  }
})

from datafire.

vdurante avatar vdurante commented on July 18, 2024

Thank you!

from datafire.

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.