Open NickDario opened 4 months ago
I'm running into a similar issue using the Drive (v3) and Sheets (v4) APIs. The first time this issue was noticed was about 2-3 weeks ago. Before then, we had been running smoothly for several months prior with the same process.
Our process is similar, we are unlocking a file with the Drive API:
await this.drive.files.update({
fileId,
requestBody: {
contentRestrictions: [{ readOnly: false }],
appProperties: { locked: 'false' },
},
});
Followed by batch operation with the sheets API after a successful response:
await this.sheets.spreadsheets.batchUpdate({
spreadsheetId,
requestBody: {
requests,
},
});
The batch update will throw the error:
"status": 403,
"code": 403,
"errors": [
{
"message": "The caller does not have permission",
"domain": "global",
"reason": "forbidden"
}
]
I've tried to add delays / exponential backoff, but as you described the delays can be up to 10 minutes. Oddly enough, the "locked" appProperty still seems to be updated immediately, but the contentRestriction is delayed. I'm also curious if there are any known issues with the drive API that may be causing the delay.
If it helps, our temporary workaround is to simply change all writer permissions to reader. I know it's far from ideal, but in our case it keeps the app usable.
Hello! I am attempting to lock two spreadsheets, run a process, then unlock them and update their data. I am using typescript and the node client from
@googleapis/drive
running on node 16 in AWS Lambda.I don't receive any errors from the lock and unlock requests, but after running the process 1-3 times sequentially, I eventually receive an error
Google API error - [403] The caller does not have permission
when updating the sheet.If I remove the locking code and everything works fine and the sheet will update as expected - however i need the sheets to be locked so users don't modify it while the process is running.
I tried adding a delay after the locking code but that didn't seem to help. it worked somewhat more reliably when I removed the oauth singleton and just instantiated it each time, which makes me suspect that could be related. However the error still occurred just after 3-5 runs. After locking, the owner is the system user so I am unable to unlock the file, however after 5-10 minutes the file will unlock on its own.
This process is running in two lambda functions that run sequentially
Are there any known bugs / specific idiosyncrasies with locking and unlocking spreadsheets that may account for this behavior? What is somewhat baffling is the file will eventually unlock after 10 minutes after it enters the locked state.
Example Error:
simplified version of the code: