Error - Request failed with status code 400
{"error":{"code":400,"message":"The specified emailAddress is invalid or not applicable for the given permission type.","errors":[{"message":"The specified emailAddress is invalid or not applicable for the given permission type.","domain":"global","reason":"invalid","location":"permission.emailAddress","locationType":"other"}]}}
I’m sorry you’re experiencing this issue. The error message indicates that the provided email address is either invalid or not applicable for the given permission type. Please double-check the email address you’re using in the userEmail prop to make sure it’s a valid email address and associated with a Google account. If the email address is correct, you can try adding the sendNotificationEmail parameter to the request and set it to false. This will prevent sending a notification email to the user when the permission is granted. Here’s the updated code: ```
import { axios } from “@pipedream/platform”; export default defineComponent({ props: { google_drive: { type: “app”, app: “google_drive”, }, folderId: { type: “string”, label: “Folder ID”, }, userEmail: { type: “string”, label: “User Email”, }, }, async run({ steps, $ }) { const url = https://www.googleapis.com/drive/v3/files/${this.folderId}/permissions; const requestBody = { role: “writer”, type: “user”, emailAddress: this.userEmail, }; const queryParams = { supportsAllDrives: true, sendNotificationEmail: false, }; try { const response = await axios($, { method: “POST”, url: url, headers: { Authorization: Bearer ${this.google_drive.$auth.oauth_access_token}, “Content-Type”: “application/json”, }, data: requestBody, params: queryParams, }); return response; } catch (error) { console.error(“Error adding user permissions:”, error); throw error; } }, });
I’m sorry to hear that you’re experiencing issues with duplicate folders. To help you better, I need to understand your workflow setup. Can you please provide more information about the trigger you’re using and any other actions or code steps in your workflow? This will help me identify the cause of the issue and suggest a solution.
To create a workflow that achieves the steps you mentioned, follow these steps: 1. Use the Google Forms - New Response trigger to start the workflow when a person fills out the form. 2. Add a Code step to process the email address: trim whitespace and convert it to lowercase. 3. Use the Google Drive - Create Folder action to create a folder with the processed email address. Here’s a sample workflow: // Step 1: Google Forms - New Response trigger // No code needed, this will be set up automatically when you add the trigger in the Pipedream UI // Step 2: Code step to process the email address export default defineComponent({ async run({ steps }) { const rawEmail = steps.trigger.event.email; // Replace 'email' with the actual field name from your form const processedEmail = rawEmail.trim().toLowerCase(); return { processedEmail }; }, }); // Step 3: Google Drive - Create Folder action // Use the Pipedream UI to add the "Google Drive - Create Folder" action // Set the "Name" field to "{{steps.<code_step_name>.processedEmail}}" // Replace <code_step_name> with the name of your code step from Step 2 Make sure to replace the field name in Step 2 with the actual field name from your Google Form. Also, replace <code_step_name> in Step 3 with the name of your code step from Step 2. This workflow should create a folder in Google Drive with the processed email address as the folder name.