Open
Description
References: nodejs/node#684
Node Version: 9.5.0
googleProvider.js
let credentials = this.serverless.service.provider.credentials;
const credParts = credentials.split(path.sep);
if (credParts[0] === '~') {
credParts[0] = os.homedir();
credentials = credParts.reduce((memo, part) => path.join(memo, part), '');
}
const keyFileContent = fs.readFileSync(credentials).toString();
const key = JSON.parse(keyFileContent);
credentials.split(path.sep)
does not appear to be splitting the path as expected.
C:\> node --version
v9.5.0
C:\> node
> let credentials = "~/.gcloud/keyfile.json"
undefined
> const credParts = credentials.split(path.sep);
undefined
> credParts
[ '~/.gcloud/keyfile.json' ]
> credParts[0]
'~/.gcloud/keyfile.json'
> const keyFileContent = fs.readFileSync(credentials).toString();
Error: ENOENT: no such file or directory, open 'C:\~\.gcloud\keyfile.json'
at Object.fs.openSync (fs.js:663:18)
at Object.fs.readFileSync (fs.js:568:33)