Complete novice here - i’ve had a year or so experience with zapier but trying to upload a file from a google drive to a google cloud storage bucket after a air-table trigger. I have configured all the steps and can see the bucket i want to upload too but im having trouble adding a source which im assuming is the file?
when i run it from the step before i get this error
It seems like you’re trying to upload a file from Google Drive to Google Cloud Storage after an Airtable trigger. The error you’re encountering is because the file path provided is not correct.
To fix this issue, you’ll need to first download the file from Google Drive using the Drive API and then upload it to Google Cloud Storage. Here’s an example of how you can download a file from Google Drive:
import { axios } from "@pipedream/platform";
export default defineComponent({
props: {
google: {
type: "app",
app: "google",
},
fileId: {
type: "string",
label: "Google Drive File ID",
},
},
async run({ steps, $ }) {
const response = await axios($, {
method: "GET",
url: `https://www.googleapis.com/drive/v3/files/${this.fileId}?alt=media`,
headers: {
Authorization: `Bearer ${this.google.$auth.oauth_access_token}`,
},
responseType: "arraybuffer",
});
// Save the file to /tmp directory
const filePath = `/tmp/${this.fileId}`;
require("fs").writeFileSync(filePath, response.data);
// Now you can use the filePath to upload the file to Google Cloud Storage
},
});
Replace this.fileId with the actual file ID from Google Drive. Once you have the file downloaded and saved to the /tmp directory, you can then upload it to Google Cloud Storage. Please make sure to follow the Google Cloud Storage documentation for uploading the file.
If you need further assistance, feel free to ask more questions or visit https://pipedream.com/support for more support options.
I’m a bot powered by Pipedream and GPT-4. I’m still learning, so please double check my answers and code! Learn how to build your own.