Where Can I Find the Documentation for `async additionalProps()` in Node.js Code Steps?

This topic was automatically generated from Slack. You can find the original thread here.

Can you give me the documentation related to async additionalProps() for Node.js code steps?

Based on the information provided and the relevant documentation, there isn’t a direct reference to async additionalProps() for Node.js code steps in the provided Pipedream documentation. However, the concept seems related to dynamically generating properties (props) for a component, which is similar to the use of async options for props. Async options allow you to programmatically generate the options for a prop based on real-time data, such as responses from an API. If you’re looking to dynamically generate props or their options in a Node.js code step, you might be referring to the ability to use async functions to define options for a prop. This is documented under the section for Async Options in the Pipedream docs. Here’s a brief example of how async options might be used within a component: export default defineComponent({ props: { exampleProp: { type: "string", label: "Example Prop", async options({ query }) { // You can make API calls or perform other asynchronous operations here // For demonstration, let's return static options filtered by the query const allOptions = [ { label: "Option 1", value: "option1" }, { label: "Option 2", value: "option2" }, // Add more options as needed ]; return allOptions.filter(option => option.label.toLowerCase().includes(query.toLowerCase())); }, }, }, async run({ steps, $ }) { // Your code here }, }); This example demonstrates how you can define a prop (exampleProp) that uses an async function to generate its options dynamically. The query parameter can be used to filter or search through options based on user input. If you were asking about a different feature or have more specific requirements, please provide additional details so I can offer more targeted assistance.

Not sure why Pi missed that one, but here you go: Component API Reference - Pipedream

Thanks! :raised_hands:

is it possible to debug the async additionalProps and similar functions (e.g., async options), using console.log statements? Mine don’t seem to show in the console.

Yes, it is possible to debug functions like async additionalProps and async options using console.log statements. However, it’s important to note that the output from these console.log statements might not appear in the same location as logs from the main async run method of your component. When you use console.log within async options or similar functions, the logs should appear in the Pipedream UI, specifically in the component or step configuration interface where you’re using these functions. If you’re not seeing the logs, ensure you’re looking in the correct part of the UI. Also, check if there are any issues with the execution context of these functions that might prevent them from running as expected. For general debugging within code steps (async run method), logs from console.log or console.error will appear just below the associated step in the Pipedream UI. console.log messages will appear in black, and console.error messages will appear in red, as detailed in the Node.js code documentation. If you continue to face issues with logging and debugging, consider visiting Pipedream support for more assistance.

We won’t actually surface the Logs section unless the step executes, and I don’t think we’ll show console logs from additionalProps there, but we might show them in your browser’s console

Thanks for the clarification. Indeed, it’s showing in the browser console.