Функции Firebase cloud paypal работает на локальном хосте, но не на сервере

#firebase #paypal #google-cloud-functions

# #firebase #paypal #google-cloud-функции

Вопрос:

Итак, я создал сервер узла в firebase cloud functions и интегрировал PayPal-node-sdk. Проблема в том, что платеж Paypal работает в режиме эмулятора firebase, который является localhost. но когда я делаю «развертывание firebase» и ввожу URL-адрес. он не выполняется и выдает ошибку.

на данный момент это код

 const functions = require('firebase-functions');
var paypal = require('paypal-rest-sdk');
paypal.configure({
    'mode': 'sandbox', //sandbox or live
    'client_id': 'ARsx8xed9TXkfOaRqh3WkeG-uzeFqT0qebkrJKssZkmBh1TWoC1ZYXpzNr8TlBDygpROnAkA8pXVmhl2',
    'client_secret': 'SECRET_KEY'
  });


exports.helloWorld = functions.https.onRequest((request, response) => {
    var create_payment_json = {
        "intent": "sale",
        "payer": {
            "payment_method": "paypal"
        },
        "redirect_urls": {
            "return_url": "http://return.url",
            "cancel_url": "http://cancel.url"
        },
        "transactions": [{
            "item_list": {
                "items": [{
                    "name": "item",
                    "sku": "item",
                    "price": "1.00",
                    "currency": "USD",
                    "quantity": 1
                }]
            },
            "amount": {
                "currency": "USD",
                "total": "1.00"
            },
            "description": "This is the payment description."
        }]
    };


    paypal.payment.create(create_payment_json, function (error, payment) {
        if (error) {
            throw error;
        } else {
            console.log("Create Payment Response");
            console.log(payment);
            for (var index = 0; index < payment.links.length; index  ) {
                //Redirect user to this endpoint for redirect url
                    if (payment.links[index].rel === 'approval_url') {
                        console.log(payment.links[index].href);
                        response.redirect(payment.links[index].href);
                    }
                }
        }
    });
});

 

Это package.json

 {
  "name": "functions",
  "description": "Cloud Functions for Firebase",
  "scripts": {
    "lint": "eslint .",
    "serve": "firebase emulators:start --only functions",
    "shell": "firebase functions:shell",
    "start": "npm run shell",
    "deploy": "firebase deploy --only functions",
    "logs": "firebase functions:log"
  },
  "engines": {
    "node": "12"
  },
  "main": "index.js",
  "dependencies": {
    "firebase-admin": "^9.2.0",
    "firebase-functions": "^3.11.0"
    },
  "devDependencies": {
    "eslint": "^5.12.0",
    "eslint-plugin-promise": "^4.0.1",
    "firebase-functions-test": "^0.2.0"
  },
  "private": true
}

 

Вот как это выглядит на локальном хосте и работает отлично

И вот как это отображается на сервере введите описание изображения здесь

В чем может быть проблема?

Файл журнала:

 [2020-11-28T20:38:09.374Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
[2020-11-28T20:38:09.375Z] > authorizing via signed-in user
[2020-11-28T20:38:09.376Z] [iam] checking project safedine-66679 for permissions ["cloudfunctions.functions.create","cloudfunctions.functions.delete","cloudfunctions.functions.get","cloudfunctions.functions.list","cloudfunctions.functions.update","cloudfunctions.operations.get","firebase.projects.get"]
[2020-11-28T20:38:09.379Z] >>> HTTP REQUEST POST https://cloudresourcemanager.googleapis.com/v1/projects/safedine-66679:testIamPermissions
 {"permissions":["cloudfunctions.functions.create","cloudfunctions.functions.delete","cloudfunctions.functions.get","cloudfunctions.functions.list","cloudfunctions.functions.update","cloudfunctions.operations.get","firebase.projects.get"]}
[2020-11-28T20:38:10.364Z] <<< HTTP RESPONSE 200 {"content-type":"application/json; charset=UTF-8","vary":"X-Origin, Referer, Origin,Accept-Encoding","date":"Sat, 28 Nov 2020 20:38:09 GMT","server":"ESF","cache-control":"private","x-xss-protection":"0","x-frame-options":"SAMEORIGIN","x-content-type-options":"nosniff","server-timing":"gfet4t7; dur=625","alt-svc":"h3-29=":443"; ma=2592000,h3-T051=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"","accept-ranges":"none","transfer-encoding":"chunked"}
[2020-11-28T20:38:10.366Z] >>> HTTP REQUEST POST https://iam.googleapis.com/v1/projects/safedine-66679/serviceAccounts/safedine-66679@appspot.gserviceaccount.com:testIamPermissions
 {"permissions":["iam.serviceAccounts.actAs"]}
[2020-11-28T20:38:11.304Z] <<< HTTP RESPONSE 200 {"content-type":"application/json; charset=UTF-8","vary":"X-Origin, Referer, Origin,Accept-Encoding","date":"Sat, 28 Nov 2020 20:38:10 GMT","server":"ESF","cache-control":"private","x-xss-protection":"0","x-frame-options":"SAMEORIGIN","x-content-type-options":"nosniff","alt-svc":"h3-29=":443"; ma=2592000,h3-T051=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"","accept-ranges":"none","transfer-encoding":"chunked"}

=== Deploying to 'safedine-66679'...

i  deploying functions
Running command: npm --prefix "$RESOURCE_DIR" run lint

> functions@ lint C:Userse7cdDocumentssafedinecloudfunctionsfunctions
> eslint .

   functions: Finished running predeploy script.
[2020-11-28T20:38:15.476Z] > [functions] package.json contents: {
  "name": "functions",
  "description": "Cloud Functions for Firebase",
  "scripts": {
    "lint": "eslint .",
    "serve": "firebase emulators:start --only functions",
    "shell": "firebase functions:shell",
    "start": "npm run shell",
    "deploy": "firebase deploy --only functions",
    "logs": "firebase functions:log"
  },
  "engines": {
    "node": "12"
  },
  "main": "index.js",
  "dependencies": {
    "firebase-admin": "^9.2.0",
    "firebase-functions": "^3.11.0"
  },
  "devDependencies": {
    "eslint": "^5.12.0",
    "eslint-plugin-promise": "^4.0.1",
    "firebase-functions-test": "^0.2.0"
  },
  "private": true
}
i  functions: ensuring required API cloudfunctions.googleapis.com is enabled...
i  functions: ensuring required API cloudbuild.googleapis.com is enabled...
[2020-11-28T20:38:16.873Z] >>> HTTP REQUEST GET https://serviceusage.googleapis.com/v1/projects/safedine-66679/services/cloudfunctions.googleapis.com

[2020-11-28T20:38:16.873Z] >>> HTTP REQUEST GET https://serviceusage.googleapis.com/v1/projects/safedine-66679/services/runtimeconfig.googleapis.com

[2020-11-28T20:38:16.874Z] >>> HTTP REQUEST GET https://serviceusage.googleapis.com/v1/projects/safedine-66679/services/cloudbuild.googleapis.com

[2020-11-28T20:38:18.073Z] <<< HTTP RESPONSE 200 {"content-type":"application/json; charset=UTF-8","vary":"X-Origin, Referer, Origin,Accept-Encoding","date":"Sat, 28 Nov 2020 20:38:17 GMT","server":"ESF","cache-control":"private","x-xss-protection":"0","x-frame-options":"SAMEORIGIN","x-content-type-options":"nosniff","alt-svc":"h3-29=":443"; ma=2592000,h3-T051=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"","accept-ranges":"none","transfer-encoding":"chunked"}
[2020-11-28T20:38:18.102Z] <<< HTTP RESPONSE 200 {"content-type":"application/json; charset=UTF-8","vary":"X-Origin, Referer, Origin,Accept-Encoding","date":"Sat, 28 Nov 2020 20:38:17 GMT","server":"ESF","cache-control":"private","x-xss-protection":"0","x-frame-options":"SAMEORIGIN","x-content-type-options":"nosniff","alt-svc":"h3-29=":443"; ma=2592000,h3-T051=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"","accept-ranges":"none","transfer-encoding":"chunked"}
   functions: required API cloudbuild.googleapis.com is enabled
[2020-11-28T20:38:18.147Z] <<< HTTP RESPONSE 200 {"content-type":"application/json; charset=UTF-8","vary":"X-Origin, Referer, Origin,Accept-Encoding","date":"Sat, 28 Nov 2020 20:38:17 GMT","server":"ESF","cache-control":"private","x-xss-protection":"0","x-frame-options":"SAMEORIGIN","x-content-type-options":"nosniff","alt-svc":"h3-29=":443"; ma=2592000,h3-T051=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"","accept-ranges":"none","transfer-encoding":"chunked"}
   functions: required API cloudfunctions.googleapis.com is enabled
[2020-11-28T20:38:18.150Z] >>> HTTP REQUEST GET https://firebase.googleapis.com/v1beta1/projects/safedine-66679/adminSdkConfig

[2020-11-28T20:38:18.628Z] <<< HTTP RESPONSE 200 {"content-type":"application/json; charset=UTF-8","vary":"X-Origin, Referer, Origin,Accept-Encoding","date":"Sat, 28 Nov 2020 20:38:18 GMT","server":"ESF","cache-control":"private","x-xss-protection":"0","x-frame-options":"SAMEORIGIN","x-content-type-options":"nosniff","alt-svc":"h3-29=":443"; ma=2592000,h3-T051=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"","accept-ranges":"none","transfer-encoding":"chunked"}
i  functions: preparing functions directory for uploading...
[2020-11-28T20:38:18.630Z] >>> HTTP REQUEST GET https://runtimeconfig.googleapis.com/v1beta1/projects/safedine-66679/configs

[2020-11-28T20:38:19.072Z] <<< HTTP RESPONSE 200 {"content-type":"application/json; charset=UTF-8","vary":"X-Origin, Referer, Origin,Accept-Encoding","date":"Sat, 28 Nov 2020 20:38:18 GMT","server":"ESF","cache-control":"private","x-xss-protection":"0","x-frame-options":"SAMEORIGIN","x-content-type-options":"nosniff","alt-svc":"h3-29=":443"; ma=2592000,h3-T051=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"","accept-ranges":"none","transfer-encoding":"chunked"}
i  functions: packaged functions (37.56 KB) for uploading
[2020-11-28T20:38:19.249Z] >>> HTTP REQUEST GET https://cloudfunctions.googleapis.com/v1/projects/safedine-66679/locations/-/functions

[2020-11-28T20:38:19.983Z] <<< HTTP RESPONSE 200 {"content-type":"application/json; charset=UTF-8","vary":"X-Origin, Referer, Origin,Accept-Encoding","date":"Sat, 28 Nov 2020 20:38:19 GMT","server":"ESF","cache-control":"private","x-xss-protection":"0","x-frame-options":"SAMEORIGIN","x-content-type-options":"nosniff","alt-svc":"h3-29=":443"; ma=2592000,h3-T051=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"","accept-ranges":"none","transfer-encoding":"chunked"}
[2020-11-28T20:38:19.984Z] >>> HTTP REQUEST POST https://cloudfunctions.googleapis.com/v1/projects/safedine-66679/locations/us-central1/functions:generateUploadUrl

[2020-11-28T20:38:20.811Z] <<< HTTP RESPONSE 200 {"content-type":"application/json; charset=UTF-8","vary":"X-Origin, Referer, Origin,Accept-Encoding","date":"Sat, 28 Nov 2020 20:38:20 GMT","server":"ESF","cache-control":"private","x-xss-protection":"0","x-frame-options":"SAMEORIGIN","x-content-type-options":"nosniff","alt-svc":"h3-29=":443"; ma=2592000,h3-T051=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"","accept-ranges":"none","transfer-encoding":"chunked"}
[2020-11-28T20:38:20.812Z] >>> HTTP REQUEST PUT https://storage.googleapis.com/gcf-upload-us-central1-d8bc2486-f64e-4507-b510-b1d84696c343/d0b11078-1545-4bd6-b169-c922d3f11142.zip?GoogleAccessId=service-884835345747@gcf-admin-robot.iam.gserviceaccount.comamp;Expires=1606597700amp;Signature=ai0sX4ZEVHlv/j/mgkmc1YtZIHT4XuRU8PvtmonlUGYl5tSJU/Tfms/yqe9ul0H5hGs7/tgwFpbmU1o5rW1HwK4QWZzUIDjkkuS+SRowqjzhAFIdJfjDeHpMstXHFZu+uwe/QPvckIGRalK78kz/SLeRphET/LMLLqii1iPWpquKdEkQpnSc3wqR0OgxBP6RdGUidJrHlelukJNcB3FH0WruaWgRDfEQkSLLqJ5dINzNssh+YpT4LZ6kyhUV0Jk/4FJkHroRKP7YhGhw2m0eoPqNRKnwn2qb8vNpff8mZ4OKPN5ANT0yvmEFxLRe6szJl2T7H3f78PsR2WsM84XTFw==
 <request body omitted>
[2020-11-28T20:38:21.339Z] <<< HTTP RESPONSE 200 {"x-guploader-uploadid":"ABg5-UxNRqvU0vC4ykLP7YdMfyT3wIFx_-8bUO_CoHXy43oH0kXgZIq_mDiQ0F9pqPALaXL0pb3RIY4kxpdk7vIDvg","etag":""db38e2617f8e5abfd2e3331528f86eb7"","x-goog-generation":"1606595900834314","x-goog-metageneration":"1","x-goog-hash":"crc32c=CS 02g==, md5=2zjiYX OWr/S4zMVKPhutw==","x-goog-stored-content-length":"38464","x-goog-stored-content-encoding":"identity","vary":"Origin","content-length":"0","date":"Sat, 28 Nov 2020 20:38:20 GMT","server":"UploadServer","content-type":"text/html; charset=UTF-8","alt-svc":"h3-29=":443"; ma=2592000,h3-T051=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43""}
   functions: functions folder uploaded successfully
i  functions: updating Node.js 12 function helloWorld(us-central1)...
[2020-11-28T20:38:21.347Z] Trigger is:  {"httpsTrigger":{}}
i  functions: updating Node.js 12 function success(us-central1)...
[2020-11-28T20:38:21.348Z] Trigger is:  {"httpsTrigger":{}}
[2020-11-28T20:38:21.350Z] >>> HTTP REQUEST PATCH https://cloudfunctions.googleapis.com/v1/projects/safedine-66679/locations/us-central1/functions/helloWorld {"updateMask":"sourceUploadUrl,name,labels,runtime,environmentVariables,httpsTrigger"}
 {"sourceUploadUrl":"https://storage.googleapis.com/gcf-upload-us-central1-d8bc2486-f64e-4507-b510-b1d84696c343/d0b11078-1545-4bd6-b169-c922d3f11142.zip?GoogleAccessId=service-884835345747@gcf-admin-robot.iam.gserviceaccount.comamp;Expires=1606597700amp;Signature=ai0sX4ZEVHlv/j/mgkmc1YtZIHT4XuRU8PvtmonlUGYl5tSJU/Tfms/yqe9ul0H5hGs7/tgwFpbmU1o5rW1HwK4QWZzUIDjkkuS+SRowqjzhAFIdJfjDeHpMstXHFZu+uwe/QPvckIGRalK78kz/SLeRphET/LMLLqii1iPWpquKdEkQpnSc3wqR0OgxBP6RdGUidJrHlelukJNcB3FH0WruaWgRDfEQkSLLqJ5dINzNssh+YpT4LZ6kyhUV0Jk/4FJkHroRKP7YhGhw2m0eoPqNRKnwn2qb8vNpff8mZ4OKPN5ANT0yvmEFxLRe6szJl2T7H3f78PsR2WsM84XTFw==","name":"projects/safedine-66679/locations/us-central1/functions/helloWorld","labels":{"deployment-tool":"cli-firebase"},"httpsTrigger":{},"runtime":"nodejs12","environmentVariables":{"FIREBASE_CONFIG":"{"projectId":"safedine-66679","databaseURL":"https://safedine-66679.firebaseio.com","storageBucket":"safedine-66679.appspot.com"}"}}
[2020-11-28T20:38:21.351Z] >>> HTTP REQUEST PATCH https://cloudfunctions.googleapis.com/v1/projects/safedine-66679/locations/us-central1/functions/success {"updateMask":"sourceUploadUrl,name,labels,runtime,environmentVariables,httpsTrigger"}
 {"sourceUploadUrl":"https://storage.googleapis.com/gcf-upload-us-central1-d8bc2486-f64e-4507-b510-b1d84696c343/d0b11078-1545-4bd6-b169-c922d3f11142.zip?GoogleAccessId=service-884835345747@gcf-admin-robot.iam.gserviceaccount.comamp;Expires=1606597700amp;Signature=ai0sX4ZEVHlv/j/mgkmc1YtZIHT4XuRU8PvtmonlUGYl5tSJU/Tfms/yqe9ul0H5hGs7/tgwFpbmU1o5rW1HwK4QWZzUIDjkkuS+SRowqjzhAFIdJfjDeHpMstXHFZu+uwe/QPvckIGRalK78kz/SLeRphET/LMLLqii1iPWpquKdEkQpnSc3wqR0OgxBP6RdGUidJrHlelukJNcB3FH0WruaWgRDfEQkSLLqJ5dINzNssh+YpT4LZ6kyhUV0Jk/4FJkHroRKP7YhGhw2m0eoPqNRKnwn2qb8vNpff8mZ4OKPN5ANT0yvmEFxLRe6szJl2T7H3f78PsR2WsM84XTFw==","name":"projects/safedine-66679/locations/us-central1/functions/success","labels":{"deployment-tool":"cli-firebase"},"httpsTrigger":{},"runtime":"nodejs12","environmentVariables":{"FIREBASE_CONFIG":"{"projectId":"safedine-66679","databaseURL":"https://safedine-66679.firebaseio.com","storageBucket":"safedine-66679.appspot.com"}"}}
[2020-11-28T20:38:21.859Z] <<< HTTP RESPONSE 200 {"content-type":"application/json; charset=UTF-8","vary":"X-Origin, Referer, Origin,Accept-Encoding","date":"Sat, 28 Nov 2020 20:38:21 GMT","server":"ESF","cache-control":"private","x-xss-protection":"0","x-frame-options":"SAMEORIGIN","x-content-type-options":"nosniff","alt-svc":"h3-29=":443"; ma=2592000,h3-T051=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"","accept-ranges":"none","transfer-encoding":"chunked"}
[2020-11-28T20:38:21.878Z] <<< HTTP RESPONSE 200 {"content-type":"application/json; charset=UTF-8","vary":"X-Origin, Referer, Origin,Accept-Encoding","date":"Sat, 28 Nov 2020 20:38:21 GMT","server":"ESF","cache-control":"private","x-xss-protection":"0","x-frame-options":"SAMEORIGIN","x-content-type-options":"nosniff","alt-svc":"h3-29=":443"; ma=2592000,h3-T051=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"","accept-ranges":"none","transfer-encoding":"chunked"}
[2020-11-28T20:38:21.879Z] >>> HTTP REQUEST GET https://cloudfunctions.googleapis.com/v1/projects/safedine-66679/locations/-/functions

[2020-11-28T20:38:22.523Z] <<< HTTP RESPONSE 200 {"content-type":"application/json; charset=UTF-8","vary":"X-Origin, Referer, Origin,Accept-Encoding","date":"Sat, 28 Nov 2020 20:38:22 GMT","server":"ESF","cache-control":"private","x-xss-protection":"0","x-frame-options":"SAMEORIGIN","x-content-type-options":"nosniff","alt-svc":"h3-29=":443"; ma=2592000,h3-T051=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"","accept-ranges":"none","transfer-encoding":"chunked"}
[2020-11-28T20:38:22.524Z] >>> HTTP REQUEST GET https://cloudfunctions.googleapis.com/v1/operations/c2FmZWRpbmUtNjY2NzkvdXMtY2VudHJhbDEvaGVsbG9Xb3JsZC96d2NJV29QNllQdw

[2020-11-28T20:38:22.525Z] >>> HTTP REQUEST GET https://cloudfunctions.googleapis.com/v1/operations/c2FmZWRpbmUtNjY2NzkvdXMtY2VudHJhbDEvc3VjY2Vzcy9CNnR2Z3ktWmRtUQ

[2020-11-28T20:38:22.900Z] <<< HTTP RESPONSE 200 {"content-type":"application/json; charset=UTF-8","vary":"X-Origin, Referer, Origin,Accept-Encoding","date":"Sat, 28 Nov 2020 20:38:22 GMT","server":"ESF","cache-control":"private","x-xss-protection":"0","x-frame-options":"SAMEORIGIN","x-content-type-options":"nosniff","alt-svc":"h3-29=":443"; ma=2592000,h3-T051=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"","accept-ranges":"none","transfer-encoding":"chunked"}
[2020-11-28T20:38:22.904Z] <<< HTTP RESPONSE 200 {"content-type":"application/json; charset=UTF-8","vary":"X-Origin, Referer, Origin,Accept-Encoding","date":"Sat, 28 Nov 2020 20:38:22 GMT","server":"ESF","cache-control":"private","x-xss-protection":"0","x-frame-options":"SAMEORIGIN","x-content-type-options":"nosniff","alt-svc":"h3-29=":443"; ma=2592000,h3-T051=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"","accept-ranges":"none","transfer-encoding":"chunked"}
[2020-11-28T20:38:24.911Z] >>> HTTP REQUEST GET https://cloudfunctions.googleapis.com/v1/operations/c2FmZWRpbmUtNjY2NzkvdXMtY2VudHJhbDEvc3VjY2Vzcy9CNnR2Z3ktWmRtUQ

[2020-11-28T20:38:24.911Z] >>> HTTP REQUEST GET https://cloudfunctions.googleapis.com/v1/operations/c2FmZWRpbmUtNjY2NzkvdXMtY2VudHJhbDEvaGVsbG9Xb3JsZC96d2NJV29QNllQdw

[2020-11-28T20:38:27.684Z] <<< HTTP RESPONSE 200 {"content-type":"application/json; charset=UTF-8","vary":"X-Origin, Referer, Origin,Accept-Encoding","date":"Sat, 28 Nov 2020 20:38:27 GMT","server":"ESF","cache-control":"private","x-xss-protection":"0","x-frame-options":"SAMEORIGIN","x-content-type-options":"nosniff","alt-svc":"h3-29=":443"; ma=2592000,h3-T051=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"","accept-ranges":"none","transfer-encoding":"chunked"}

[2020-11-28T20:38:29.703Z] >>> HTTP REQUEST GET https://cloudfunctions.googleapis.com/v1/operations/c2FmZWRpbmUtNjY2NzkvdXMtY2VudHJhbDEvc3VjY2Vzcy9CNnR2Z3ktWmRtUQ

[2020-11-28T20:38:30.061Z] <<< HTTP RESPONSE 200 {"content-type":"application/json; charset=UTF-8","vary":"X-Origin, Referer, Origin,Accept-Encoding","date":"Sat, 28 Nov 2020 20:38:29 GMT","server":"ESF","cache-control":"private","x-xss-protection":"0","x-frame-options":"SAMEORIGIN","x-content-type-options":"nosniff","alt-svc":"h3-29=":443"; ma=2592000,h3-T051=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"","accept-ranges":"none","transfer-encoding":"chunked"}
[2020-11-28T20:38:30.086Z] <<< HTTP RESPONSE 200 {"content-type":"application/json; charset=UTF-8","vary":"X-Origin, Referer, Origin,Accept-Encoding","date":"Sat, 28 Nov 2020 20:38:29 GMT","server":"ESF","cache-control":"private","x-xss-protection":"0","x-frame-options":"SAMEORIGIN","x-content-type-options":"nosniff","alt-svc":"h3-29=":443"; ma=2592000,h3-T051=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"","accept-ranges":"none","transfer-encoding":"chunked"}
[2020-11-28T20:38:32.074Z] >>> HTTP REQUEST GET https://cloudfunctions.googleapis.com/v1/operations/c2FmZWRpbmUtNjY2NzkvdXMtY2VudHJhbDEvaGVsbG9Xb3JsZC96d2NJV29QNllQdw

[2020-11-28T20:38:32.089Z] >>> HTTP REQUEST GET https://cloudfunctions.googleapis.com/v1/operations/c2FmZWRpbmUtNjY2NzkvdXMtY2VudHJhbDEvc3VjY2Vzcy9CNnR2Z3ktWmRtUQ

[2020-11-28T20:38:32.461Z] <<< HTTP RESPONSE 200 {"content-type":"application/json; charset=UTF-8","vary":"X-Origin, Referer, Origin,Accept-Encoding","date":"Sat, 28 Nov 2020 20:38:32 GMT","server":"ESF","cache-control":"private","x-xss-protection":"0","x-frame-options":"SAMEORIGIN","x-content-type-options":"nosniff","alt-svc":"h3-29=":443"; ma=2592000,h3-T051=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"","accept-ranges":"none","transfer-encoding":"chunked"}
[2020-11-28T20:38:32.462Z] <<< HTTP RESPONSE 200 {"content-type":"application/json; charset=UTF-8","vary":"X-Origin, Referer, Origin,Accept-Encoding","date":"Sat, 28 Nov 2020 20:38:32 GMT","server":"ESF","cache-control":"private","x-xss-protection":"0","x-frame-options":"SAMEORIGIN","x-content-type-options":"nosniff","alt-svc":"h3-29=":443"; ma=2592000,h3-T051=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"","accept-ranges":"none","transfer-encoding":"chunked"}
[2020-11-28T20:38:34.473Z] >>> HTTP REQUEST GET https://cloudfunctions.googleapis.com/v1/operations/c2FmZWRpbmUtNjY2NzkvdXMtY2VudHJhbDEvc3VjY2Vzcy9CNnR2Z3ktWmRtUQ

[2020-11-28T20:38:34.474Z] >>> HTTP REQUEST GET https://cloudfunctions.googleapis.com/v1/operations/c2FmZWRpbmUtNjY2NzkvdXMtY2VudHJhbDEvaGVsbG9Xb3JsZC96d2NJV29QNllQdw

[2020-11-28T20:38:34.838Z] <<< HTTP RESPONSE 200 {"content-type":"application/json; charset=UTF-8","vary":"X-Origin, Referer, Origin,Accept-Encoding","date":"Sat, 28 Nov 2020 20:38:34 GMT","server":"ESF","cache-control":"private","x-xss-protection":"0","x-frame-options":"SAMEORIGIN","x-content-type-options":"nosniff","alt-svc":"h3-29=":443"; ma=2592000,h3-T051=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"","accept-ranges":"none","transfer-encoding":"chunked"}
[2020-11-28T20:38:34.854Z] <<< HTTP RESPONSE 200 {"content-type":"application/json; charset=UTF-8","vary":"X-Origin, Referer, Origin,Accept-Encoding","date":"Sat, 28 Nov 2020 20:38:34 GMT","server":"ESF","cache-control":"private","x-xss-protection":"0","x-frame-options":"SAMEORIGIN","x-content-type-options":"nosniff","alt-svc":"h3-29=":443"; ma=2592000,h3-T051=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"","accept-ranges":"none","transfer-encoding":"chunked"}
[2020-11-28T20:38:36.841Z] >>> HTTP REQUEST GET https://cloudfunctions.googleapis.com/v1/operations/c2FmZWRpbmUtNjY2NzkvdXMtY2VudHJhbDEvc3VjY2Vzcy9CNnR2Z3ktWmRtUQ

[2020-11-28T20:38:36.856Z] >>> HTTP REQUEST GET https://cloudfunctions.googleapis.com/v1/operations/c2FmZWRpbmUtNjY2NzkvdXMtY2VudHJhbDEvaGVsbG9Xb3JsZC96d2NJV29QNllQdw

[2020-11-28T20:38:37.211Z] <<< HTTP RESPONSE 200 {"content-type":"application/json; charset=UTF-8","vary":"X-Origin, Referer, Origin,Accept-Encoding","date":"Sat, 28 Nov 2020 20:38:36 GMT","server":"ESF","cache-control":"private","x-xss-protection":"0","x-frame-options":"SAMEORIGIN","x-content-type-options":"nosniff","alt-svc":"h3-29=":443"; ma=2592000,h3-T051=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"","accept-ranges":"none","transfer-encoding":"chunked"}
[2020-11-28T20:38:37.217Z] <<< HTTP RESPONSE 200 {"content-type":"application/json; charset=UTF-8","vary":"X-Origin, Referer, Origin,Accept-Encoding","date":"Sat, 28 Nov 2020 20:38:36 GMT","server":"ESF","cache-control":"private","x-xss-protection":"0","x-frame-options":"SAMEORIGIN","x-content-type-options":"nosniff","alt-svc":"h3-29=":443"; ma=2592000,h3-T051=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"","accept-ranges":"none","transfer-encoding":"chunked"}
[2020-11-28T20:38:39.212Z] >>> HTTP REQUEST GET https://cloudfunctions.googleapis.com/v1/operations/c2FmZWRpbmUtNjY2NzkvdXMtY2VudHJhbDEvc3VjY2Vzcy9CNnR2Z3ktWmRtUQ

[2020-11-28T20:38:39.228Z] >>> HTTP REQUEST GET https://cloudfunctions.googleapis.com/v1/operations/c2FmZWRpbmUtNjY2NzkvdXMtY2VudHJhbDEvaGVsbG9Xb3JsZC96d2NJV29QNllQdw

[2020-11-28T20:38:39.582Z] <<< HTTP RESPONSE 200 {"content-type":"application/json; charset=UTF-8","vary":"X-Origin, Referer, Origin,Accept-Encoding","date":"Sat, 28 Nov 2020 20:38:39 GMT","server":"ESF","cache-control":"private","x-xss-protection":"0","x-frame-options":"SAMEORIGIN","x-content-type-options":"nosniff","alt-svc":"h3-29=":443"; ma=2592000,h3-T051=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"","accept-ranges":"none","transfer-encoding":"chunked"}
[2020-11-28T20:38:39.590Z] <<< HTTP RESPONSE 200 {"content-type":"application/json; charset=UTF-8","vary":"X-Origin, Referer, Origin,Accept-Encoding","date":"Sat, 28 Nov 2020 20:38:39 GMT","server":"ESF","cache-control":"private","x-xss-protection":"0","x-frame-options":"SAMEORIGIN","x-content-type-options":"nosniff","alt-svc":"h3-29=":443"; ma=2592000,h3-T051=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"","accept-ranges":"none","transfer-encoding":"chunked"}
[2020-11-28T20:38:41.583Z] >>> HTTP REQUEST GET https://cloudfunctions.googleapis.com/v1/operations/c2FmZWRpbmUtNjY2NzkvdXMtY2VudHJhbDEvaGVsbG9Xb3JsZC96d2NJV29QNllQdw

[2020-11-28T20:39:22.100Z] >>> HTTP REQUEST GET https://cloudfunctions.googleapis.com/v1/operations/c2FmZWRpbmUtNjY2NzkvdXMtY2VudHJhbDEvaGVsbG9Xb3JsZC96d2NJV29QNllQdw

[2020-11-28T20:39:24.854Z] <<< HTTP RESPONSE 200 {"content-type":"application/json; charset=UTF-8","vary":"X-Origin, Referer, Origin,Accept-Encoding","date":"Sat, 28 Nov 2020 20:39:24 GMT","server":"ESF","cache-control":"private","x-xss-protection":"0","x-frame-options":"SAMEORIGIN","x-content-type-options":"nosniff","alt-svc":"h3-29=":443"; ma=2592000,h3-T051=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"","accept-ranges":"none","transfer-encoding":"chunked"}
!  functions[success(us-central1)]: Deployment error.
Function failed on loading user code. Error message: Error: please examine your function logs to see the error cause: https://cloud.google.com/functions/docs/monitoring/logging#viewing_logs. Additional troubleshooting documentation can be found at https://cloud.google.com/functions/docs/troubleshooting#logging

Functions deploy had errors with the following functions:
        helloWorld
        success


To try redeploying those functions, run:
    firebase deploy --only "functions:helloWorld,functions:success"

To continue deploying other features (such as database), run:
    firebase deploy --except functions

Error: Functions did not deploy properly.

C:Userse7cdDocumentssafedinecloudfunctions>

 

Войдите в систему с консоли firebase

 3:13:13.689 am
helloWorld
Error: function terminated. Recommended action: inspect logs for termination reason. Additional troubleshooting documentation can be found at https://cloud.google.com/functions/docs/troubleshooting#logging Function invocation was interrupted.

helloWorld
Error: function terminated. Recommended action: inspect logs for termination reason. Additional troubleshooting documentation can be found at https://cloud.google.com/functions/docs/troubleshooting#logging Function invocation was interrupted.
 
3:13:48.825 am
helloWorld
Function execution started

3:13:49.144 am
helloWorld
Provided module can't be loaded.
 

Комментарии:

1. Пожалуйста, отредактируйте вопрос, чтобы показать журналы ошибок для функции, а не для клиентского приложения в браузере.

2. В сообщении об ошибке указано, куда обращаться для поиска ошибок.

3. Я перепробовал все возможные решения, я не знаю, почему он работает на локальном хосте и не работает на сервере при развертывании

Ответ №1:

Из https://github.com/paypal/PayPal-node-SDK#usage:

Добавьте зависимость «paypal-rest-sdk» в ваш файл package.json.

Это одна из причин, по которой ваша функция не запускается.

Учитывая, что вы публично поделились своими учетными данными для доступа к PayPal, я настоятельно рекомендую вам создать новую пару и деактивировать те, которые вы включили.