PipedreamHQ / pipedream

Connect APIs, remarkably fast. Free for developers.
https://pipedream.com
Other
9.02k stars 5.27k forks source link

[BUG] Google Drive - Cannot create pdf file from google doc template #14138

Closed LucBerge closed 1 month ago

LucBerge commented 2 months ago

Describe the bug I am not able to generate pdf file from google doc template using the Create file from template action.

To Reproduce Steps to reproduce the behavior:

  1. Create a file in google drive and get the id
  2. Create a workflow with the Google drive - Create file from template action
  3. In the mode field, select the pdf option
  4. Test the step

Expected behavior Pdf file created at the expected location.

Current behavior

FetchError

invalid json response body at https://www.googleapis.com/upload/drive/v3/files?uploadType=multipart&alt=json reason: Unexpected token '<', "<html><hea"... is not valid JSON

Stack trace:
    at null.null (/tmp/__pdg__/dist/code/5a57c33732a575ac4ba9957da31e30c2a6f0a06d3587913bbc68d06658a177dd/node_modules/.pnpm/node-fetch@2.7.0/node_modules/node-fetch/lib/index.js:273:32)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at null.null (/tmp/__pdg__/dist/code/5a57c33732a575ac4ba9957da31e30c2a6f0a06d3587913bbc68d06658a177dd/node_modules/.pnpm/google-docs-mustaches@1.2.2/node_modules/google-docs-mustaches/lib/apis/fetch.js:25:27)
    at Object.run (file:///tmp/__pdg__/dist/code/5a57c33732a575ac4ba9957da31e30c2a6f0a06d3587913bbc68d06658a177dd/code/actions/create-file-from-template/create-file-from-template.mjs:91:21)
    at null.executeComponent (/var/task/launch_worker.js:292:22)
    at MessagePort.messageHandler (/var/task/launch_worker.js:792:28)

Additional context

vunguyenhung commented 2 months ago

I can reproduce this issue image

Might be related to https://github.com/PipedreamHQ/pipedream/issues/14141. Though I'll add to component backlog for component dev to check

LucBerge commented 2 months ago

@vunguyenhung You need to remove the curly braces in the action. {{test}}:value1 -> test:value1

Might be related to https://github.com/PipedreamHQ/pipedream/issues/14141.

Not entirely sure because the error is in the export method in google-docs-mustaches package while the upload action in pipedream uses the create method.

jcortes commented 2 months ago

@vunguyenhung and @LucBerge I couldn't reproduce this issue. This is the evidence I recorded just in case

https://github.com/user-attachments/assets/fb5bf504-73ee-470a-bee7-3c7f77f3b192

However I can see this block might be a potential issue in the library because it doesn't have an error handler inside the if block.

Can you please send a screenshot of the file you were using as the template, thanks in advance!

Also can you please if possible use this PR to test again since I've added a couple of console.logs to see we can catch those errors somehow.

vunguyenhung commented 2 months ago

Hi @LucBerge, could you help sharing the information requested by @jcortes?

LucBerge commented 1 month ago

Hello, I saw there is a component update. I did it and it successfully worked. Looks like the last two commits from @andrewjschuang fixed this issue...

14151

14155

jcortes commented 1 month ago

@vunguyenhung Ok can you please close this issue since it has to do with this comment by @andrewjschuang

vunguyenhung commented 1 month ago

Thanks for the clarification @jcortes @LucBerge. Closing this now.