我正在使用firebase项目中的IAP-receipt-validator https://github.com/sibelius/iap-receipt-validator/blob/master/README.md
import iapReceiptValidator from 'iap-receipt-validator';
部署时出现“意外标识符”错误。
顺便说一句,我改变了行
var iapReceiptValidator = require('iap-receipt-validator');
要
#Pig latin
pig= ("ay")
word = input("Enter a word: ")# prompt for a phrase and assign result to a variable
vowels="aeiou" # list of vowels
words = word.split()
# for word in words
for i in range(len(word)):# assign first letter of phrase to a string variable, for later use
if word[i][0] in vowels: # is first letter a vowel
print(word[i] + 'way') # if first letter is a vowel, print word + 'way'
elif word[i][1] in vowels:
print(word[i][1:]+word[i][0] + 'ay' # assign second letter of phrase to a string variable, for later use
else:
print(word[i]+ [1:]=('ay') # otherwise print word with first two letters moved to end & added 'ay'
请帮忙。
答案 0 :(得分:0)
使用以下
var iapReceiptValidator = require('iap-receipt-validator').default;
<强>编辑:强>
错误是因为您在代码中使用了await
。如果要使用await,则应使用async
注释父函数。如下所示:
exports.validate = functions.https.onRequest(async (request, response) => {
try {
const validationData = await validateReceipt(request.body.receiptData);
response.send(JSON.stringify(validationData));
} catch(err) {
console.log(err.valid, err.error, err.message)
}
});
请检查您正在使用的Node.js版本是否应支持async / await。否则你必须回到承诺。