n8n-io / n8n

Free and source-available fair-code licensed workflow automation tool. Easily automate tasks across different services.
https://n8n.io
Other
48.48k stars 7.59k forks source link

Google Drive Node Sharing Notifications and UI options not working as expected #1354

Closed Adrian-Samuel closed 3 years ago

Adrian-Samuel commented 3 years ago

Problem:

Essentially, I'm using the Google Drive node to share a given google sheet to a specific user via their email address. In the n8n Drive node I select the options to send a notification email to the recipient the document is being shared to but unfortunately this option does not seem to work (and can sometimes throw buggy error messages about a boolean toggle option being blank when executed).

A fuller description of these problems below:

  1. Bug One - Incorrect boolean option set in the JSON flow despite clearly select the right option in the UI

The buggy boolean error message can be seen here:

Screen Shot 2021-01-18 at 7 46 37 PM

The way to overcome this error is to toggle the send notification on and off again and mostly it goes away...Though it makes me afraid of the presence of random errors when the flow is automated. - This is one bug

The export of this flow looks like this:

{
  "name": "Test create Sheet",
  "nodes": [
    {
      "parameters": {},
      "name": "Start",
      "type": "n8n-nodes-base.start",
      "typeVersion": 1,
      "position": [
        250,
        300
      ]
    },
    {
      "parameters": {
        "operation": "share",
        "fileId": "1Ahesou0myRuX9_lOVHJauc2gaTRgp75uSge-KFgsLOc",
        "permissionsUi": {
          "permissionsValues": {
            "role": "writer",
            "type": "user",
            "emailAddress": "someuser@gmail.com" 
          }
        },
        "options": {
          "emailMessage": "Hey! Check out this file",
          "sendNotificationEmail": ""
        }
      },
      "name": "Google Drive",
      "type": "n8n-nodes-base.googleDrive",
      "typeVersion": 1,
      "position": [
        550,
        310
      ],
      "credentials": {
        "googleApi": "Sheet Credentials"
      }
    }
  ],
  "connections": {
    "Start": {
      "main": [
        []
      ]
    }
  },
  "active": false,
  "settings": {
    "saveManualExecutions": true
  },
  "id": "10"
}

Note that on the options.sendNotificationEmail the option is sent to an empty string even though it is clearly a "true" boolean in the n8n UI as seen by the above-accompanied screenshot.

To test this out properly, I would suggest manually setting up the Node in the UI so you get a feel of where and how the error occurs.

Bug 2:

The document (the google sheet in this case) gets shared but the notification email or assigned message along with that notification doesn't get sent - this is the second bug.

This is the JSON of this flow:

{
  "name": "Test_Share_G_Sheet",
  "nodes": [
    {
      "parameters": {},
      "name": "Start",
      "type": "n8n-nodes-base.start",
      "typeVersion": 1,
      "position": [
        250,
        300
      ]
    },
    {
      "parameters": {
        "operation": "share",
        "fileId": "1Ahesou0myRuX9_lOVHJauc2gaTRgp75uSge-KFgsLOc",
        "permissionsUi": {
          "permissionsValues": {
            "role": "writer",
            "type": "user",
            "emailAddress": "someuser@gmail.com"
          }
        },
        "options": {
          "emailMessage": "Hey! Check out this doc!",
          "sendNotificationEmail": true
        }
      },
      "name": "Google Drive",
      "type": "n8n-nodes-base.googleDrive",
      "typeVersion": 1,
      "position": [
        480,
        300
      ],
      "credentials": {
        "googleApi": "Sheet Credentials"
      }
    }
  ],
  "connections": {
    "Start": {
      "main": [
        [
          {
            "node": "Google Drive",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "saveManualExecutions": true,
    "executionTimeout": -1
  },
  "id": "10"
}

More of a feature request:

Since the node doesn't have the "allowFileDiscovery" boolean option to make it searchable via the google sheets UI. You have to foreknow the URL to access and know it's been shared to you...which is additionally problematic if you're using this flow for teamwork. - This is more of a feature request but would sit nicely together with the above bug fixes.

I saw this boolean option here: https://developers.google.com/drive/api/v3/reference/files/update

Screen Shot 2021-01-18 at 8 04 34 PM

Happy to answer any additional questions about this!

RicardoE105 commented 3 years ago

@Adrian-Samuel thanks for explaining this so clearly. @ivov Just fixed it. We will let you know when is released.

About the allowFileDiscovery. It is already implemented but only visible for permission types domain and anyone.

allowFileDiscovery boolean Whether the permission allows the file to be discovered through search. This is only applicable for permissions of type domain or anyone. Source

image

janober commented 3 years ago

Fix got now merged with #1354 and will be merged with the next version.

janober commented 3 years ago

Got released with n8n@0.104.0

Adrian-Samuel commented 3 years ago

I just upgraded, unfortunately, I think this node is broken now!

{
  "name": "Test sheetg",
  "nodes": [
    {
      "parameters": {},
      "name": "Start",
      "type": "n8n-nodes-base.start",
      "typeVersion": 1,
      "position": [
        250,
        300
      ]
    },
    {
      "parameters": {
        "resource": "spreadsheet",
        "title": "lol",
        "options": {}
      },
      "name": "Google Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 1,
      "position": [
        710,
        380
      ],
      "credentials": {
        "googleApi": "Sheet Credentials"
      },
      "disabled": true
    },
    {
      "parameters": {
        "operation": "share",
        "fileId": "={{$json[\"spreadsheetId\"]}}",
        "permissionsUi": {
          "permissionsValues": {
            "role": "writer",
            "type": "user",
            "emailAddress": "adriansamuel22@gmail.com"
          }
        },
        "options": {
          "emailMessage": "Send to you!",
          "sendNotificationEmail": true
        }
      },
      "name": "Google Drive",
      "type": "n8n-nodes-base.googleDrive",
      "typeVersion": 1,
      "position": [
        910,
        380
      ],
      "credentials": {
        "googleApi": "Sheet Credentials"
      }
    }
  ],
  "connections": {
    "Google Sheets": {
      "main": [
        [
          {
            "node": "Google Drive",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "saveManualExecutions": true
  },
  "id": "14"
}

This flow doesn't work. There's a successful execution but no JSON response, and subsequently, the email that it's shared to not only now doesn't receive the email notification but it also doesn't get shared at all

ivov commented 3 years ago

@Adrian-Samuel I'll test closely tomorrow, but this might be due to the previous node being disabled. Click on the Play button to enable.

image

Update: Thank you for reporting this. Two separate changes were made in parallel to this node recently: this param fix and the drive resource addition. The merge introduced a condition that never evaluates to true, causing the share and delete options to now fail. We'll let you know as soon as it's fixed.