The library I have used is node-persist -- link
The idea is to save a token in a file using the above library for a particular time period, which can be used while the google cloud function trigger.
But I'm getting below error while saving fresh token in google function workspace.
error => [Error: EROFS: read-only file system, unlink '/workspace/tmp/94c8aa2452bccd82ee129b46f7c4be79'] {
errno: -30,
code: 'EROFS',
syscall: 'unlink',
path: '/workspace/tmp/94c8aa2452bccd82ee129b46f7c4be79'
}
Got the Solution
Can do file system operation on /tmp or os.tmpdir()
https://cloud.google.com/appengine/docs/standard/nodejs/using-temp-files