Why Is It Saying That Action Is Not Valid Please Try Again
Fifty-fifty the most experienced developer rarely writes code correctly on the first try, making troubleshooting an important part of the development process. In this department nosotros'll encompass some techniques that can aid you discover, sympathize, and debug errors in your scripts.
Error messages
When your script encounters an fault, an fault bulletin is displayed. The bulletin is accompanied by a line number used for troubleshooting. There are ii basic types of errors displayed in this way: syntax errors and runtime errors.
Syntax errors
Syntax errors are caused by writing code that doesn't follow the JavaScript grammar, and the errors are detected as soon as y'all try to save the script. For case, the following code snippet contains a syntax error:
function emailDataRow(rowNumber) { var sheet = SpreadsheetApp.getActiveSheet(); var information = canvas.getDataRange().getValues(); var rowData = information[rowNumber-1].bring together(" "; MailApp.sendEmail('john@example.com', 'Information in row ' + rowNumber, rowData); }
The syntax problem hither is a missing )
graphic symbol at the end of the fourth line. When yous try to save the script you'll get the post-obit error:
Missing ) after argument listing. (line 4)
These types of errors are commonly unproblematic to troubleshoot, since they are constitute right away and typically take simple causes. You aren't able to save a file that contains syntax errors, meaning that only valid code is saved into your projection.
Runtime errors
These errors are caused by using a role or grade incorrectly, and can only be detected once the script has been run. For example, the following code causes a runtime fault:
function emailDataRow(rowNumber) { var sheet = SpreadsheetApp.getActiveSheet(); var data = sheet.getDataRange().getValues(); var rowData = data[rowNumber-1].join(" "); MailApp.sendEmail('john', 'Information in row ' + rowNumber, rowData); }
The code is formatted correctly, but we are passing the value "john" for the email address when calling MailApp.sendEmail
. Since this is not a valid email accost the following error is thrown when running the script:
Invalid email: john (line 5)
What makes these errors more than challenging to troubleshoot is that frequently the data you lot are passing into a role is non written in the code, but instead pulled from a spreadsheet, form, or other external data source. Using the debugging techniques below can aid y'all to identify the cause of these errors.
Common errors
Beneath is a list of mutual errors and their causes.
Service invoked too many times: <action name>
This error indicates that yous take exceeded your daily quota for a given action. For example, y'all might come across this error if you send too many emails in a single day. The quotas are set at different levels for consumer, domain, and premier accounts and are subject to modify at any time without a prior announcement by Google. Yous can view the quota limits for various actions in the Apps Script quota documentation.
Server not available. or Server error occurred, please endeavour again.
At that place are a few possible causes for these errors:
- A Google server or system is temporarily unavailable. Wait for a few moments and endeavor running the script again.
- At that place is an error in your script that doesn't accept a corresponding error message. Try debugging your script and see if you lot can isolate the problem.
- There is a problems in Google Apps Script that is causing this mistake. For instructions on searching for and filing bug reports, see the Bugs. Before filing a new bug, search to run across if others have already reported it.
This error indicates that the script is lacking the authorization needed to run. When a script is run in the Script Editor or from a custom card item an authorization dialog is presented to the user. Notwithstanding, when a script is run from a trigger, embedded with a Google Sites folio, or run as a service, the dialog cannot exist presented and this fault is shown.
To authorize the script, open the Script Editor and run any function. The say-so prompt appears so y'all can authorize the script project. If the script contains new unauthorized services, you must re-authorize the script.
This error is frequently caused past triggers that are firing before the user has authorized them. If you lot don't accept access to the script project (because the fault is occurring for an add-on yous use, for example), you tin can commonly qualify the script by using the add-on once again. If a trigger continues to fire and crusade this error, you can remove your triggers past doing the post-obit:
New editor
- At the left of the Apps Script project, click Triggers .
- At the right of the trigger you want to remove, click More > Delete trigger.
Legacy editor
- Select Edit > All your triggers in the Apps Script editor. The resulting dialog shows all agile triggers running on your account.
- Find the offending trigger in the listing.
- Click the icon adjacent to the trigger name to remove it.
- Click Salvage to record the deletion.
You tin also remove problematic addition triggers by uninstalling the improver.
Access denied: DriveApp or The domain policy has disabled third-political party Drive apps
Administrators of Google Workspace domains have the power to disable the Drive SDK for their domain, which prevents their users from installing and using Google Drive apps. This setting also prevents the users from beingness able to use Apps Script add-ons that utilise the Bulldoze service or Avant-garde Drive Service (fifty-fifty if the script was authorized prior to the admin disabling Drive SDK).
Still, if an add-on or web app using the Bulldoze service is published for domain-wide installation and is installed by the ambassador for some or all users in the domain, the script functions for those users fifty-fifty if the Drive SDK is disabled in the domain.
The script does non take permission to go the agile user'south identity.
Indicates that the active user's identity and email are not available to the script. This warning results from a telephone call to Session.getActiveUser()
. It can also result from a phone call to Session.getEffectiveUser()
if the script is running in an potency manner other than AuthMode.FULL
. If this warning is signaled, subsequent calls to User.getEmail()
only return "".
There are a number of ways to troubleshoot this warning, depending on the say-so mode the script is running under. The authorization style is exposed in triggered functions as the authMode
property of the e
result parameter.
- In
AuthMode.Full
, consider usingSession.getEffectiveUser()
instead. - In
AuthMode.LIMITED
, ensure that the owner has authorized the script. - In other authorisation modes, avert calling either method.
- If you are a Google Workspace customer newly experiencing this warning from an installable trigger, ensure that the trigger is running as a user within your organisation.
Library is missing
If you lot add a popular library to your script, y'all might receive an error message stating that it's missing, even though the library is listed as a dependency for your script. The reason might be that too many people are accessing the library at the same time. To avoid this error, attempt one of the following solutions:
- Re-create and paste the library's code into your script and remove the library dependency.
- Copy the library script and deploy it as a library from your business relationship. Be sure to update the dependency in your original script to the new library instead of the public one.
Debugging
Not all mistakes crusade an mistake message to exist displayed. There might be a more subtle error where the lawmaking is technically right and can execute, only the results are not what you expect. Here are some strategies for treatment such situations and further investigating a script that is not running the fashion you expect.
Logging
While debugging it's ofttimes helpful to tape information equally a script projection executes. Google Apps Script has two methods for logging information: the Deject logging service and the more than basic Logger and console services that are built in to the Apps Script editor.
See the Logging guide for more details.
Mistake Reporting
Exceptions that occur considering of runtime errors are automatically recorded using the Google Cloud Error Reporting service. This service lets you search and filter exception messages your script project creates.
New editor
To access Error Reporting, run into View Cloud logs and error reports in the Google Cloud Platform console.
Legacy editor
Y'all can enable Error Reporting the start fourth dimension you select View > Stackdriver Logging or View > Stackdriver Error Reporting in a new script.
Once enabled, exceptions that occur because of runtime errors are automatically recorded using the Google Cloud Stackdriver service. This service lets you search and filter exception messages your script project creates. You can reach the Stackdriver Fault Reporting interface past selecting View > Stackdriver Error Reporting in the Apps Script editor.
Executions
New editor
Every fourth dimension you run a script, Apps Script makes a record of the execution, including the Deject logs. These records can help you lot understand which deportment your script performed.
To view the executions of your script in the Apps Script project, at the left, click Executions .
Legacy editor
Every time yous run a script, Apps Script makes a record of the execution, including the Cloud logs. These records can assist you to sympathize which actions your script performed. To view the executions of your script, select View > Executions in the Apps Script editor. This opens the Executions panel for the script in the Apps Script dashboard.
Checking Apps Script service status
Although rare, sometimes specific Google Workspace services (such equally Gmail or Drive) encounter temporary problems that can pb to service outages. When this occurs, Apps Script projects that interact with these services may non function equally expected.
You can check if there is a Google Workspace service outage by viewing the Google Workspace Status Dashboard. If an outage is currently being experienced, yous either expect for it to be resolved or seek additional help in the Google Workspace Help Center or the Google Workspace Known Problems documentation.
Utilise the debugger and breakpoints
To locate issues in your script, you can run information technology in debug way. When run in debug style, a script pauses when information technology hits a breakpoint, which is a line you've highlighted in your script that yous think may take a problem. When a script pauses it displays the value of each variable at that point in time, allowing yous to inspect the inner workings of a script without having to add a lot of logging statements.
Add a breakpoint
New editor
To add a breakpoint, hover over the line number of the line you lot want to add the breakpoint to. At the left of the line number, click the circle. The below image shows an example of a breakpoint added to a script:
Legacy editor
To add a breakpoint click on the line number for the line y'all desire to pause at.
Run a script in debug mode
New editor
To run the script in debug mode, at the elevation of the editor click Debug.
Before the script runs the line with the breakpoint it pauses and displays a table of debug information. You can use this tabular array to inspect data like the values of parameters and the information stored in objects.
To control how the script is run, at the pinnacle of the Debugger panel, utilize the "Pace in", "Footstep over", and "Step out" buttons. These allow you lot run the script i line at a fourth dimension and inspect how values change over time.
Legacy editor
To run the script in debug way, click the bug icon () in the toolbar. Before the script runs the line with the breakpoint it pauses and displays a table of debug data.
This table allows you to audit the values of the parameters like row
and electronic mail
, besides as the data stored in the data
object. Discover that the rowData
variable doesn't have a value assigned still, because the script paused before that line was executed.
When the script is paused, an extra ready of buttons are displayed in the toolbar which allow you to command how the script is run. Using the "step in", "pace over", and "pace out" buttons you tin run the script one line at a time, allowing you to inspect how values alter over time.
Issues with multiple Google Accounts
If you're logged into multiple Google Accounts at the same time, you might have problem accessing your Apps Script projects, add-ons, and web apps. Multi-login, or being logged into multiple Google Accounts at in one case, isn't supported for Apps Script, add together-ons, or web apps.
To ready problems from multi-login, endeavor i of the post-obit solutions:
- Log out of all your Google Accounts and simply log in to the i that has the Apps Script project, add-on, or web app you need to access.
- Open up an incognito window in Google Chrome, or an equivalent private browsing window, and log in to the Google Account that has the Apps Script projection, add-on, or web app y'all need to access.
Getting help
Debugging a problem using the tools and techniques listed in a higher place can solve a diversity of issues, simply there may be problems you meet that crave some actress help to solve. See our Support page for data on where to inquire questions and file bugs.
collinshathapasse.blogspot.com
Source: https://developers.google.com/apps-script/guides/support/troubleshooting
0 Response to "Why Is It Saying That Action Is Not Valid Please Try Again"
Post a Comment