Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Object for request is wrong. Please confirm formData again. #3

Open
tacmorales opened this issue Apr 13, 2020 · 3 comments
Open

Object for request is wrong. Please confirm formData again. #3

tacmorales opened this issue Apr 13, 2020 · 3 comments

Comments

@tacmorales
Copy link

tacmorales commented Apr 13, 2020

Hi! I was very happy for found it yor librarie but with a quick example, i've been receiving the same error message:

Error: Object for request is wrong. Please confirm formData again. at FetchApp.Fetch(Code:66:17) at fetch(Code:17:27)

The code I use is the one you provide in README, and I don't know what I am missing:

function main() {
  var folder = DriveApp.getFolderById('')
  var file = folder.getFilesByName('Salvoconducto Okima.pdf').next()
  var id = file.getId();
  var fileBlob = DriveApp.getFileById(id).getBlob();
  
  var metadata = {
    name: "OCR-PDF-" + (new Date()).getYear(),
    mimeType: MimeType.GOOGLE_DOCS
  };
  
  var form = FetchApp.createFormData();
  form.append("metadata", Utilities.newBlob(JSON.stringify(metadata), "application/json"));
  form.append("file", fileBlob);
  var url = "https://www.googleapis.com/upload/drive/v3/files?uploadType=multipart";
  
  var params = {
    method: "POST",
    headers: { Authorization: "Bearer " + ScriptApp.getOAuthToken() },
    body: form
    // muteHttpExceptions: true
  };
  
  var res = FetchApp.fetch(url, params);
  console.log(res);
  // DriveApp.createFile(blob) // This comment line is used for automatically detecting scope for running this sample script.
}

I tried with the code of closed issue but still give me the same error :(
I hope you can help me!

(Sorry for my english)

@tanaikech
Copy link
Owner

Thank you for your comment. I could confirm about the error. It was found that the reason of this error is due to that V8 runtime is enabled. So I removed the error. In the current stage, the version is v1.0.1. By this, this library can be used with both enabling and disabling V8. Could you please confirm it?

@oshliaer
Copy link

oshliaer commented Dec 4, 2020

I confirm. All modes work fine.

@tanaikech
Copy link
Owner

@contributorpw Thank you for your always support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants