import { axios } from “@pipedream/platform”;
import { createClient } from “@supabase/supabase-js”;
export default defineComponent({
name: “velora-github-issues-source-GET”,
description:
“This is a custom source for Velora AI, which fetches user credentials from an external source, and then uses the GET API to fetch GitHub issues for a user repo, with 15-minute timer intervals.”,
props: {
db: “$.service.db”,
},
methods: {
_getLastDate() {
return this.db.get(“lastDate”) || this.oneDayAgo;
},
_setLastDate(lastDate) {
this.db.set(“lastDate”, lastDate);
},
},
async run({ steps, $ }) {
const velora_supabase_project_url = ${process.env.VELORA_SUPABASE_PROJECT_URL};
const velora_supabase_service_key = ${process.env.VELORA_SUPABASE_SERVICE_KEY};
The code you provided has a few issues and improvements that can be made to align with Pipedream’s best practices and the correct use of components. Here is the corrected version of your code: 1. The db prop should be defined as a data_store type. 2. The run method should return the result of _getLastDate instead of the function itself. 3. The axios import is not used in your code, so it can be removed. 4. The createClient import from @supabase/supabase-js is not necessary if you are not using it in the run method. Here is the corrected code: import { defineComponent } from "@pipedream/types"; export default defineComponent({ name: "velora-github-issues-source-GET", description: "This is a custom source for Velora AI, which fetches user credentials from an external source, and then uses the GET API to fetch GitHub issues for a user repo, with 15-minute timer intervals.", props: { db: { type: "data_store", }, }, methods: { _getLastDate() { return this.db.get("lastDate") || this.oneDayAgo; }, _setLastDate(lastDate) { this.db.set("lastDate", lastDate); }, }, async run({ steps, $ }) { const velora_supabase_project_url = process.env.VELORA_SUPABASE_PROJECT_URL; const velora_supabase_service_key = process.env.VELORA_SUPABASE_SERVICE_KEY; // If you need to use Supabase, uncomment the following lines // const supabase = createClient( // velora_supabase_project_url, // velora_supabase_service_key // ); this._setLastDate("5th June"); return this._getLastDate(); }, }); ### Explanation of Changes: 1. Define db as data_store: This allows you to use the data store methods correctly. 2. Return the result of _getLastDate: Ensure that the method is called and its result is returned. 3. Remove unused imports: Clean up the code by removing unnecessary imports. 4. Comment out Supabase client creation: If you don’t
To help you resolve the issue with your Pipedream workflow component, let’s make sure the code is correctly structured and uses the appropriate Pipedream component conventions. Specifically, we’ll ensure the correct use of the axios import from @pipedream/platform and the proper handling of the response data. Here’s the revised code: import { axios } from "@pipedream/platform"; export default defineComponent({ props: { nango: { type: "app", app: "nango", }, }, async run({ steps, $ }) { const response = await axios($, { method: "GET", url: "https://api.nango.dev/connection/test-connection-id?provider_config_key=github", headers: { Authorization: `Bearer ${this.nango.$auth.nango_secret_key}`, }, data: { org_id: "o_PwIP1O1", project_id: "proj_GzsL0b2", }, }); console.log(response); return response; }, }); ### Key Changes: 1. Import axios from @pipedream/platform: This ensures the correct context is used for the HTTP request. 2. Use props to define the Nango app: This allows you to connect your Nango account and access the credentials. 3. Return the response: Ensure the response data is returned from the run method so it can be used downstream in your workflow. ### Explanation: - props: Defines the Nango app, allowing you to connect your Nango account. - axios: Makes the HTTP GET request to the Nango API. - Authorization header: Uses the Nango secret key from the connected account. - data: Includes the org_id and project_id in the request body. - return response: Returns the response data so it can be used in subsequent steps. If you still encounter issues, please ensure that the NANGO_KEY environment variable is correctly set and that the Nango API endpoint and parameters are correct. If the problem persists, you may want to check the Nango API documentation for any additional requirements or troubleshooting steps. Feel free to reach out if you need further assistance!
To address the issue you’re facing with the code, it seems like you want to make an HTTP request to the Nango API without using the Nango app prop. Let’s modify your code to ensure it works correctly in a Pipedream workflow component. Here is the corrected code: import { axios } from "@pipedream/platform"; export default defineComponent({ async run({ steps, $ }) { const response = await axios($, { method: "GET", url: "https://api.nango.dev/connection/test-connection-id?provider_config_key=github", headers: { Authorization: `Bearer ${process.env.NANGO_KEY}`, }, data: { org_id: "o_PwIP1O1", project_id: "proj_GzsL0b2", }, }); console.log(response); return response; }, }); ### Key Changes: 1. Importing axios from @pipedream/platform: This ensures the request is made within the Pipedream environment. 2. Removing const { response }: The axios call directly returns the response data, so you don’t need to destructure it. 3. Returning the response: This will make the response data available for downstream steps in your workflow. ### Additional Notes: - Ensure that process.env.NANGO_KEY is correctly set in your environment variables. - The data field in a GET request is unusual. If the API expects these parameters, they should typically be included in the query string. However, if the API does accept a body with a GET request, this code should work as expected. If you continue to face issues, please provide more details or consider using the Pipedream support for further assistance.
To create a prop for a UUID in a Pipedream component, you can define a prop of type string and optionally add a description to indicate that it should be a UUID. Here is an example of how you can define such a prop in a Pipedream component: import { defineComponent } from "@pipedream/types"; export default defineComponent({ props: { uuid: { type: "string", label: "UUID", description: "A unique identifier in UUID format", }, }, async run({ steps, $ }) { // You can access the UUID prop using this.uuid const uuid = this.uuid; // Your code here return { uuid }; }, }); In this example: - The uuid prop is defined with a type of string. - The label is set to “UUID” to make it clear in the UI. - The description provides additional context to the user. You can then use this.uuid within the run method to access the value of the UUID prop.