google-play-billing-validator
google-play-billing-validator copied to clipboard
Firebase function deploy error !
Description
Everything works but when I upload my function to firebase functions it gives me an error
Steps to Reproduce
- I tried to Reproduce but the same it gives me an error but if I didn't import
var Verifier = require('google-play-billing-validator');
the function will be uploaded .
Sample code
exports.buycoins = functions.https.onCall(async (data, context) => {
const productID = data['productID'];
const token = data['token'];
const packageName = "";
const user_id = data['uid'];
const options = {
"email": '',
"key": ''
};
var verifier = new Verifier(options);
let receipt = {
packageName: packageName,
productId: productID,
purchaseToken: token
};
}
let promiseData = verifier.verifyINAPP(receipt).then(async (response)=> {
if(response['isSuccessful'] == true){
return true;
}else{
return false;
}
})
.catch(function (error) {
return false;
});
});
Images :
Actual behavior:
[What actually happened]
Versions
You can get this information from executing npm version
.
{
npm: '6.14.14',
ares: '1.17.2',
brotli: '1.0.9',
cldr: '39.0',
icu: '69.1',
llhttp: '2.1.3',
modules: '83',
napi: '8',
nghttp2: '1.42.0',
node: '14.17.5',
openssl: '1.1.1k',
tz: '2021a',
unicode: '13.0',
uv: '1.41.0',
v8: '8.4.371.23-node.76',
zlib: '1.2.11'
}
This issue is fixed. I should install pkg inside the function folder, not in the main folder.