Error in google scripts - DocumentApp.openById - google-apps-script

Since a couple of days im having this error:
We're sorry, a server error occurred. Please wait a bit and
try again
When this line its executed:
var temp = DocumentApp.openById(newTemplate.getId());
My code was working already, so i think its something internal of Google?
Any help? Thanks a lot
Alejandro

It seems like there is curently a bug
See here and here.
While you might get this error because of e.g. trying to open a non Google Docs document with DocumentApp, it is also possible that your problem is related to the bug.
give it a star to increase visibility.

Related

Suddenly moveActiveSheet returns an error - Google Apps Script

I am getting the following error:
Exception: Service Spreadsheets failed while accessing document with
id . . .
when I try to execute a script on a Google sheet.
The script worked fine until today.
I believe the problem occurs between these two lines:
var newTab = sheet.duplicateActiveSheet();
sheet.moveActiveSheet(1);
because at the time of the error the duplicate sheet has been created
but has not yet been moved to the first position.
Is it possible that the "moveActiveSheet" command suddenly can not
find the new active sheet that has just been created?
If so, is there some other way to do this?
There seems to be a bug and it has already been reported.
The issue has been already reported today (15th of December) in the IssueTracker by 13 users (as of now).
Click on the star ⭐ icon to the top/upper-left corner of the webpage to make the issue more popular in order for Google to fix it sooner.
This workaround solution might be useful, I haven't tested it, but you can give it a try.
The problem is an internal error in the moveActiveSheet line.
I have found a work around for the problem.
In the script comment out the moveActiveSheet line as shown here:
var newTab = sheet.duplicateActiveSheet();
// sheet.moveActiveSheet(1);
sheet.renameActiveSheet(newTabName);
This will result in the new tab being misplaced.
You can manually move it to the first position.
Google claims to be working on a fix for this problem.
See https://issuetracker.google.com/issues/175625775
The bug occurs when pos in sheet.moveActiveSheet(pos) is 1
While the bug is being fixed, as a workaround, instead of e.g. moving the second sheet to the first position, you can move the first sheet to the second position.
Because
sheet.moveActiveSheet(2);
still works.

Out of memory error for more than a day. Code does not run

I made a Slackbot with Google Apps Script and everything was fine until yesterday I started getting Out of memory error out of nowhere. Now I can't even run any of my working code. Has anyone encountered something similar? Not even console.log() will print, it just gives the same error. I tried running a simple function with console.log() in it and that didn't work either.
This is the code in my project. I wrote an infinite loop before to do spreadsheet actions but now it is removed.
function test() {
console.log("1");
}
The Out of memory error alert occurs because a variable grew too much on size. Without looking at your code I can't point which variable caused this behaviour, but I can help you in the right direction: first of all make sure that you are not saving all the data in a single variable. After that, check that there is no infinite loop in the code.
I hope to have helped you, but if you keep facing the problem don't hesitate to share the code so I can help you better.

Goobric Script Error

I have been getting the pictured email for 3 weeks now. I have remove and reinstalled both Goobric and Doctopus to see if it would fix the error. I have attempted to debug as well to no avail. I know nothing of coding or script writing but I am willing to try anything to stop getting these. Any help is greatly appreciated.
Where it says "click here" you will be led to a place where you can remove the time trigger that is causing this notification.

Rename function doesn't work, Visual Studio 2013 RC

I want to rename a file with rename function:
rename("old_name.txt", "new_name.txt")
but it doesn't work. Any ideas why?
Are you checking the return value to see if you're getting an error code (non-zero). The response is detailed here. http://msdn.microsoft.com/en-us/library/zw5t957f%28v=vs.110%29.aspx. That should help you pin it down.
Typically I've seen this be due to permission issues or the fact that the location is wrong. Maybe you think it is running in "c:\abc" but it is really "c:\xyz".

Am I using the find method of the folder class correctly?

I had a script that used the find method of the folder class and it has worked fine for quite a while. Suddenly today it stopped working. I get the 'We're sorry, a server error occured. Please wait a bit and try again' message. It stopped working this morning.
I was able to recreate this error with just a few lines of code in new small script.
function myFunction() {
folder = DocsList.getFolder('test');
folder.find('testfile');
Logger.log('anything');
}
I made sure I had a folder called test and a file called testfile inside of it.
Any ideas why I am getting this error?
Thank you.
This has been recently reported as an issue -
https://code.google.com/p/google-apps-script-issues/issues/detail?id=2482
Please star it so that you can get notified of updates.