Firebase 函数,解析错误:意外的标记 =>

0 javascript checkout firebase

我正在使用 Js 构建我的第一个 firebase 函数,以使用 Checkout.com API 处理卡支付,我已经安装了 checkout 和 firebase JavaScript SDK,这是我的 index.js 文件夹:

const functions = require("firebase-functions");
const { Checkout } = require("checkout-sdk-node");
const cko = new Checkout("sk_test_XXXXX-XXXX-XXXX");

exports.payWithToken = functions.https.onCall(async (data, context) => {
    try {
        const payment = await cko.payments.request({
            source: {
                token: data.token,
            },
            customer: {
                email: context.auth.token.email
            },
            currency: data.currency,
            amount: data.amount,
        })
        return {
            "Status": payment.status,
            "3DS-Link": payment.redirectLink,
            "Approved": approved,
            "Flagged": risk.flagged,
        };
    } catch (error) {
        console.log(error)
        throw new functions.https.HttpsError(error.name, error.message, error);
    }
});
Run Code Online (Sandbox Code Playgroud)

我认为我正确地遵循了文档,但由于某种原因,我无法将此函数部署到 firebase 并且收到此错误:

解析错误:意外的标记 =>

Mah*_*ahi 5

package.json中,

改变这个

    "lint": "eslint .",
Run Code Online (Sandbox Code Playgroud)

对此

    "lint": "eslint",
Run Code Online (Sandbox Code Playgroud)