I am trying to read a file under certs folder as shown below:
-functions
|
--certs
|
---idp-public-cert.perm
Here is the code I am using to read the file:
fs.readFileSync(path.join(__dirname, 'certs/idp-public-cert.pem'))
.
When I run the function, I get the following errors:
Error: ENOENT: no such file or directory, open '/srv/lib/certs/idp-public-cert.pem'
I would appreciate any crew on how to do this. Thanks in advance.
You need to add the google-cloud-storage package to your requirements. txt file to install it in the Cloud Functions environment.
Just read the file using the relative path certs/idp-public-cert.pem
. All relative paths will be interpreted relative to your deployed functions folder. Don't try to build a full path to the file, as you shouldn't assume where your code deployment is effectively mounted in the server instance.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With