have you tried making a trivial change to your workflow and deploying a new version of your workflow? Each time you test or deploy your workflow, we install the latest version of each imported package. You can also pin package versions. @U05A7KLNALC can you tell me how to pin package versions in Node.js components?
In Pipedream, you can pin a specific version of a package by specifying the version number in the import statement. For example, if you wanted to use version 1.2.3 of the puppeteer package, you would import it like this: ```
import puppeteer from “puppeteer@1.2.3”;
Got it, yes the Puppeteer API can change and with the move to native Puppeteer vs. Browserless it may require some changes. But let us know if you hit errors you can’t solve and I’ll try to assist
In Pipedream, you can use the $send.http function to send the screenshot as a response to an HTTP request. Here’s an example of how you can do this: ```
import { promises as fs } from “fs”; import path from “path”; export default { name: “send-screenshot”, version: “0.0.1”, props: { http: “$.interface.http”, }, async run({ $ }) { // Assume screenshot.png is the screenshot you’ve saved in the /tmp directory const screenshotPath = path.join(“/tmp”, “screenshot.png”); // Read the screenshot file const screenshot = await fs.readFile(screenshotPath); // Send the screenshot as a response to the HTTP request $.res.set(“Content-Type”, “image/png”); $.res.status(200).send(screenshot); }, };
You can use the $.respond function in a workflow to send a response back to the HTTP client that triggered the workflow. Here’s an example of how you can modify the previous code to use $.respond to send a screenshot: ```
import { promises as fs } from “fs”; import path from “path”; export default { name: “send-screenshot”, version: “0.0.1”, async run({ $ }) { // Assume screenshot.png is the screenshot you’ve saved in the /tmp directory const screenshotPath = path.join(“/tmp”, “screenshot.png”); // Read the screenshot file const screenshot = await fs.readFile(screenshotPath); // Send the screenshot as a response to the HTTP request $.respond({ status: 200, headers: { “Content-Type”: “image/png”, }, body: screenshot, }); }, };
To configure your workflow with an HTTP trigger to return a custom response, you can use the $.respond function in a code step. Here’s an example of how you can do this: import { promises as fs } from "fs"; import path from "path"; export default { name: "send-screenshot", version: "0.0.1", async run({ $ }) { // Assume screenshot.png is the screenshot you've saved in the /tmp directory const screenshotPath = path.join("/tmp", "screenshot.png"); // Read the screenshot file const screenshot = await fs.readFile(screenshotPath); // Send the screenshot as a response to the HTTP request $.respond({ status: 200, headers: { "Content-Type": "image/png", }, body: screenshot, }); }, }; This code reads a file named screenshot.png from the /tmp directory and sends it as a response to the HTTP request that triggered the workflow. The $.respond function sets the HTTP status code, headers, and body of the response. Please replace “screenshot.png” with the actual name of your screenshot file.