I use the Files Helper (v0.0.7) to create a file form some CSV data and then send the resulting file link in an email.
When I in TEST mode, the email gets properly produced and I can download the file from the link. However, when the flow runs, it does NOT provide a valid link to the file.
Basically the links (URL) you see when you test your step was meant for you to just see the output of your step while testing in your browser, but it is not intended for use in production runs, so you would basically need to upload the file you wrote to google drive or dropbox or any other file hosting services and use the link from there.
I created a setep to Create File in Google Drive and I am getting the same behavior - it is working correctly and generating a link while Testing, but in Production runs, it does not include the right link.
I get the same behavior, even though the file is saved in Google Drive.
I am having the exact same issue… See the right side, which is what happens when i test the step, vs the left side which is the output when I am testing the run… The link provided when I test the step gives me a download link for the file, not really anything that would work to add to Google Drive as far as I can tell…
The idea here is that the Create File Piece is used to prepare a file to be uploaded to another service like Google Drive, Dropbox, SFTP, S3 storage, etc.
Like you, I originally thought that it was a way to create the file, and I could just use it as the Download link for that file. However, that is not the case, as the file is not generated during Production runs.
I believe this is by design because Activepieces does not aim to be a file storage solution.
I then tried to use the Google Drive solution. However, in my case, Google Drive will not work. This is because the Google Drive API only supports providing Download links for binary files (such as a PDF). I was generating a CSV file (text file), and therefore the response I received from the Google Drive - Set public access action did not return a download URL.
I solved this by using the Create file piece to prepare the file for upload. Then, I used the Amazon S3 > Upload File action to upload the file to my S3 provider. My S3 provider does not allow creating public buckets, so I also had to make an API request to get a pre-signed URL.
The only drawback is that the pre-signed URL can be valid for a maximum of 7 days.
I have the same issue when creating a file with Google Drive as well. There appears to be no way to do anything with that file. With the Google Drive method the output isnt file://xxxxx but the cloud.activepieces URL that leads to a download file that is a random string followed by .false, instead of filename.html as I have instructed it to do.
That is an interesting solution, and I was thinking that I could do what you said originally, but it made more sense to me that it creates the file and then you have to do something with it internally (like upload to S3 or Google Drive, etc.) and then utilize the file.
The STRANGE thing here is it IS creating a link and allowing me to download it. If you click the link above, it will allow you to download the file… From ActivePieces URL… It just appends “.false” to the end of the file.
Here is what I am trying to do:
Create a file on Google Drive (with the content from the piece) = this is working fine
Set public access (also appears to be working fine and creates a URL, but it, again, is an active pieces URL NOT the Google Drive URL, strangely enough)
Get the URL from Google somehow (I tried “Read” as in your example, but that also returns an AP URL…)
Provide URL via Slack (working but the URL from activepieces appends “.false” to the end of it)
Alternatively, you can use the Text Helper piece, to Replace .false with nothing and use the output of the piece as the URL to send in the Slack message.
Even if this turns out to be a defect and it gets fixed, the Replace should not break anything if it doesn’t find the .false in the URL.
That is actually a really good idea. 2 issues, I do not have the paid slack version, so I lose messages after a set amount of time, so if I need to look back in the future, like 3 months down the line, for some reason, I wont have it to refer to. And 2, I am not 100% sure I can dump hundreds of 2k word files into Slack, but I might test it in the meantime.
It still kind of defeats the idea of the team being able to quickly and easily pull up the HTML in a browser window by clicking on it. But might be a temp workaround.
This video has a little more detail of what I am doing. Maybe I am still doing something incorrectly.
Yeah, I was wrong, it is giving me the AP URL during testing, and file://… during regular runs…
I do not know why after uploading to Drive and then changing permissions, it would give a URL from AP instead of Google Drive, ever… Obviously if someone wants to add global permissions, they are most likely going to want the shareable link to that file…
I think the .false is something on the AP side that is supposed to be indicating something internally, as opposed to something that we are supposed to be seeing. This has to be a bug.
I’m frustrated by this. Why on earth would you lead a user to build a flow in test mode that isn’t what they would use in production. Maybe you should make it an option (if this is even necessary) to enable your convenient links or not.
Even after setting my file’s permissions to public, the image URL is set to “file://…”
This is the output of my Set public access action:
{
“kind”: “drive#permission”,
“id”: “anyoneWithLink”,
“type”: “anyone”,
“role”: “reader”,
“allowFileDiscovery”: false,
“downloadUrl”: “file://step_22/2024-07-11_Invoice”
}
How is the downloadUrl getting set to this “file://…” string? I’ve tried several workarounds but can’t manage to find a way to get this to work. Please help!
Sorry for harsh tone earlier. I had spent hours on my flow, I fought one limitation after another, found workarounds, trying to get ChatGPT to give me valid JSON (TIP: Prompt it to “Ensure the JSON structure is VALID and FLAT meaning it does not contain nested objects or arrays. Do not provide a string representation of JSON.”). Everything was going well until this came up. My flow is currently dead in the water, sitting un-run in the AP Uncategorized folder. It is just so frustrating as I want to use my flow to help me digitise receipts for my personal finances and my business. It’s a fine flow, if I do say so myself.
I tried adding a step to use a Base64 version of the image but my images are large files as they are detailed receipts but the test run just hangs forever. When I test the action individually, AP freezes and I have to refresh. OpenAI recommends against sending Base64 images over a certain file size.
I’d be ever so tremendously, tearfully and pathetically grateful to anyone who can provide a fix, workaround or even a sliver of hope for better times ahead. I’m on my knees. I just want to get this flow done. Thank you!
export const code = async (inputs) => {
// Extract the file ID from the webViewLink
const match = inputs.webViewLink.match(/\/d\/(.+?)\//);
if (match && match[1]) {
const fileId = match[1];
// Construct the transparent URL
const transparentUrl = `https://drive.usercontent.google.com/download?id=${fileId}`;
return transparentUrl;
} else {
throw new Error("Invalid webViewLink format.");
}
};
Bear in mind that earlier in the flow, I make the entire folder I’m processing (and hence its contents) publicly accessible. At the end of the flow, I remove the public access.
It’s great to see you’ve found a solution for obtaining a usable Google Drive URL by converting the opaque link to a transparent one. For others facing similar issues, ensuring the file’s visibility and permissions are correctly set before generating the shareable URL is crucial. Using code to transform Drive’s webViewLink into a direct download URL can effectively address the limitations of Drive’s default URL format in workflows.