Firebase deploy returns unknown error - firebase

I am trying to deploy my site to firebase which I have done before but now it is saying "Error: An unknown error occurred. Please contact support." The contents of the firebase-debug.log file follows:
[debug] ----------------------------------------------------------------------
[debug] Command: /usr/bin/nodejs /usr/bin/firebase deploy
[debug] Platform: linux
[debug] Node Version: v4.3.0
[debug] Time: Mon Feb 22 2016 13:58:38 GMT-0700 (MST)
[debug] ----------------------------------------------------------------------
[debug]
[debug] >>> HTTP REQUEST GET https://admin.firebase.com/firebase/joshweaverspark/token?token=XXX
[error]
[error] Error: An unknown error occurred. Please contact support.
[debug] Error Context: {
"requestOptions": {
"method": "GET",
"json": true,
"url": "https://admin.firebase.com/firebase/joshweaverspark/token?token=-KA3RgJFHuDHz6BHvFQF%7C3b00cd5fc3e1c76f43a26385a3f680c0"
},
"body": {
"error": {
"code": "UNKNOWN_ERROR",
"message": "An unknown error occurred. Please contact support."
}
},
"response": {
"statusCode": 500,
"body": {
"error": {
"code": "UNKNOWN_ERROR",
"message": "An unknown error occurred. Please contact support."
}
},
"headers": {
"server": "nginx",
"date": "Mon, 22 Feb 2016 20:58:54 GMT",
"content-type": "application/json; charset=utf-8",
"content-length": "97",
"connection": "close",
"access-control-allow-origin": "*",
"access-control-allow-methods": "GET, PUT, POST, DELETE, OPTIONS",
"x-content-type-options": "nosniff"
},
"request": {
"uri": {
"protocol": "https:",
"slashes": true,
"auth": null,
"host": "admin.firebase.com",
"port": 443,
"hostname": "admin.firebase.com",
"hash": null,
"search": "?token=-KA3RgJFHuDHz6BHvFQF%7C3b00cd5fc3e1c76f43a26385a3f680c0",
"query": "token=-KA3RgJFHuDHz6BHvFQF%7C3b00cd5fc3e1c76f43a26385a3f680c0",
"pathname": "/firebase/joshweaverspark/token",
"path": "/firebase/joshweaverspark/token?token=-KA3RgJFHuDHz6BHvFQF%7C3b00cd5fc3e1c76f43a26385a3f680c0",
"href": "https://admin.firebase.com/firebase/joshweaverspark/token?token=-KA3RgJFHuDHz6BHvFQF%7C3b00cd5fc3e1c76f43a26385a3f680c0"
},
"method": "GET",
"headers": {
"accept": "application/json"
}
}
}
}

After updating Node.js, i was able to deploy the project.
You can try the same by updating Node.js:
sudo npm install npm#latest -g

In my case upgrading node and npm wasn't enough, but upgrading firebase-tools, fixed the problem
npm install -g firebase-tools

Related

Invalid patch error in Contentful CMA client

I am trying to populating an empty field by using patch method in Contentful. The following piece of code works in one cloned environment but does not work in another.
let patchData: OpPatch[] = [
{
op: 'replace',
path: '/fields/keywords',
value: entryKeyword,
},
];
await cmaClient.entry.patch({ entryId: entryId }, patchData, { 'X-Contentful-Version': entryVersion });
When I try to execute this, receiving a 'Unprocessable Entity' error:
UnprocessableEntity: {
"status": 422,
"statusText": "Unprocessable Entity",
"message": "Could not apply patch to entry: invalid patch",
"details": {},
"request": {
"url": "/spaces/xyz/environments/abc/entries/123456789",
"headers": {
"Accept": "application/json, text/plain, */*",
"Content-Type": "application/json-patch+json",
"X-Contentful-User-Agent": "sdk contentful-management-plain.js/7.54.2;",
"Authorization": "Bearer ...",
"user-agent": "node.js/v14.19.2",
"Accept-Encoding": "gzip",
"X-Contentful-Version": 25,
"Content-Length": 78
},
"method": "patch",
"payloadData": "[{\"op\":\"replace\",\"path\":\"/fields/keywords\",\"value\":\"test keyword\"}]"
},
"requestId": "abcd-123456"
}
I have the same exact access permissions to both environments. What am I missing out on?
I had the same issue - turned out when the entry doesn't have the filed you're trying to patch - it will throw an error like above.

Google endpoints is ignoring headers with underscore key

I have integrated my k8s deployment with google endpoints. I have 12 services out of which 11 services are working fine with google endpoints except for one service. When its transferring requests to application container its ignoring the header values with underscore.
Implementation
I have added this in my application deployment (Ignore syntax i have it in correct format in deployment)
- args:
- --http_port
- "8081"
- --backend
- 127.0.0.1:8080
- --service
- <MY_ENDPOINT>
- --service_account_key
- /etc/nginx/creds/<MY_CREDS>
- --rollout_strategy=managed
image: gcr.io/endpoints-release/endpoints-runtime:1
imagePullPolicy: Always
name: esp
ports:
- containerPort: 8081
protocol: TCP
resources: {}
volumeMounts:
- mountPath: /etc/nginx/creds
name: service-account-creds
readOnly: true
Here in the below sample, i have sent two headers with TEST-CODE and TEST_CODE. Both are getting received at the application end when i am sending request via application port, but when i access it via esp port, i receive only header with -(hyphen) not with _(underscore). TEST-CODE is being received in the server but not TEST_CODE, when accessing via esp.
When i am sending request to my application using curl or postman via 8080 which is application port
curl -XPOST http://localhost:8080/<CONTEXT_PATH> -H "Content-Type: application/json" -H "USER-ID: abc" -H "TEST-CODE: xyz" -H "TEST_CODE: wxyz"
I get response like this
{
"timestamp": "2020-04-05T19:42:44.958564Z",
"principal": null,
"session": null,
"request": {
"method": "POST",
"uri": "http://localhost:8080/<MY_URL>",
"headers": {
"host": [
"localhost:8080"
],
"test-code": [
"xyz"
],
"content-type": [
"application/json"
],
"x-user-id": [
"abc"
],
"test_code": [
"wxyz"
],
"user-agent": [
"curl/7.52.1"
],
"accept": [
"*/*"
]
},
"remoteAddress": null
},
"response": {
"status": 200,
"headers": {
"Content-Length": [
"435"
],
"Date": [
"Sun, 05 Apr 2020 19:42:45 GMT"
],
"Content-Type": [
"application/json;charset=UTF-8"
]
}
},
"timeTaken": 633
}
When i am sending request to my application using curl or postman via 8081 which is via esp
curl -XPOST http://localhost:8081/<CONTEXT_PATH>?key=<MY_KEY> -H "Content-Type: application/json" -H "USER-ID: abc" -H "TEST-CODE: xyz" -H "TEST_CODE: wxyz"
I get response like this
{
"timestamp": "2020-04-05T19:42:57.102184Z",
"principal": null,
"session": null,
"request": {
"method": "POST",
"uri": "http://localhost/<MY_URL>?<MY_KEY>",
"headers": {
"x-real-ip": [
"127.0.0.1"
],
"x-google-real-ip": [
"127.0.0.1"
],
"x-cloud-trace-context": [
"<MY_GOOGLE_TRACE_CONTEXT>"
],
"host": [
"localhost"
],
"test-code": [
"xyz"
],
"x-endpoint-api-project-id": [
"<MY_ENDPOINT_PROJECT_ID>"
],
"content-type": [
"application/json"
],
"x-forwarded-for": [
"127.0.0.1"
],
"x-user-id": [
"abc"
],
"user-agent": [
"curl/7.52.1"
],
"accept": [
"*/*"
]
},
"remoteAddress": null
},
"response": {
"status": 400,
"headers": {
"Connection": [
"close"
],
"Content-Length": [
"256"
],
"Date": [
"Sun, 05 Apr 2020 19:42:57 GMT"
],
"Content-Type": [
"application/json"
]
}
},
"timeTaken": 21
}
Again,
Notice the difference : I am sending test code header as TEST-CODE and TEST_CODE, both are coming when i am accessing via application port, but when i am accessing via esp container, the application is receiving TEST-CODE alone, not TEST_CODE.
I have tried some other HEADERS with -(hyphen) and some with _(underscore). Every time headers with -(hyphen) is being received via esp to application but not with _(underscore).
I have took the above responses from spring actuator endpoints (actuator/httptrace)
Can someone help?

Firebase CLI: TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type undefined

On firebase cli version 7.11.0 I am getting this error when running firebase serve or firebase deploy.
// terminal error
owner#G700:~/PhpstormProjects/shopify/buyUsedServer$ firebase serve --debug
[2020-01-10T21:56:29.047Z] ----------------------------------------------------------------------
[2020-01-10T21:56:29.060Z] Command: /home/owner/.nvm/versions/node/v10.16.3/bin/node /usr/local/bin/firebase serve --debug
[2020-01-10T21:56:29.061Z] CLI Version: 7.11.0
[2020-01-10T21:56:29.061Z] Platform: linux
[2020-01-10T21:56:29.061Z] Node Version: v10.16.3
[2020-01-10T21:56:29.062Z] Time: Sat Jan 11 2020 04:56:29 GMT+0700 (Indochina Time)
[2020-01-10T21:56:29.064Z] ----------------------------------------------------------------------
[2020-01-10T21:56:29.064Z]
[2020-01-10T21:56:29.083Z] > 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-01-10T21:56:29.083Z] > authorizing via signed-in user
[2020-01-10T21:56:29.084Z] [iam] checking project buyusedshopify for permissions ["firebase.projects.get"]
[2020-01-10T21:56:29.087Z] >>> HTTP REQUEST POST https://cloudresourcemanager.googleapis.com/v1/projects/buyusedshopify:testIamPermissions
permissions=[firebase.projects.get]
[2020-01-10T21:56:30.516Z] <<< HTTP RESPONSE 200 content-type=application/json; charset=UTF-8, vary=X-Origin, Referer, Origin,Accept-Encoding, date=Fri, 10 Jan 2020 21:56:30 GMT, server=ESF, cache-control=private, x-xss-protection=0, x-frame-options=SAMEORIGIN, x-content-type-options=nosniff, server-timing=gfet4t7; dur=1191, alt-svc=quic=":443"; ma=2592000; v="46,43",h3-Q050=":443"; ma=2592000,h3-Q049=":443"; ma=2592000,h3-Q048=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000, accept-ranges=none, transfer-encoding=chunked
[2020-01-10T21:56:30.519Z] >>> HTTP REQUEST GET https://firebase.googleapis.com/v1beta1/projects/buyusedshopify
[2020-01-10T21:56:31.188Z] <<< HTTP RESPONSE 200 content-type=application/json; charset=UTF-8, vary=X-Origin, Referer, Origin,Accept-Encoding, date=Fri, 10 Jan 2020 21:56:31 GMT, server=ESF, cache-control=private, x-xss-protection=0, x-frame-options=SAMEORIGIN, x-content-type-options=nosniff, alt-svc=quic=":443"; ma=2592000; v="46,43",h3-Q050=":443"; ma=2592000,h3-Q049=":443"; ma=2592000,h3-Q048=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000, accept-ranges=none, transfer-encoding=chunked
=== Serving from '/home/owner/PhpstormProjects/shopify/buyUsedServer'...
[2020-01-10T21:56:31.194Z] >>> HTTP REQUEST GET https://firebase.googleapis.com/v1beta1/projects/buyusedshopify/webApps/-/config
[2020-01-10T21:56:31.197Z] TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type undefined
at validateString (internal/validators.js:125:11)
at Object.join (path.js:1147:7)
at Object.<anonymous> (/usr/local/lib/node_modules/firebase-tools/lib/serve/functions.js:20:39)
at Generator.next (<anonymous>)
at /usr/local/lib/node_modules/firebase-tools/lib/serve/functions.js:7:71
at new Promise (<anonymous>)
at __awaiter (/usr/local/lib/node_modules/firebase-tools/lib/serve/functions.js:3:12)
at Object.start (/usr/local/lib/node_modules/firebase-tools/lib/serve/functions.js:18:16)
at /usr/local/lib/node_modules/firebase-tools/lib/serve/index.js:15:23
at arrayMap (/usr/local/lib/node_modules/firebase-tools/node_modules/lodash/lodash.js:639:23)
at Function.map (/usr/local/lib/node_modules/firebase-tools/node_modules/lodash/lodash.js:9554:14)
at _serve (/usr/local/lib/node_modules/firebase-tools/lib/serve/index.js:13:26)
at Command.module.exports.Command.description.option.option.option.option.before.action [as actionFn] (/usr/local/lib/node_modules/firebase-tools/lib/commands/serve.js:58:12)
at Command.<anonymous> (/usr/local/lib/node_modules/firebase-tools/lib/command.js:156:25)
at Generator.next (<anonymous>)
at fulfilled (/usr/local/lib/node_modules/firebase-tools/lib/command.js:4:58)
Error: An unexpected error has occurred.
Does anyone know what may cause this? Here is also my firebase.json:
// firebase.json
{
"firestore": {
"rules": "firestore.rules",
"indexes": "firestore.indexes.json"
},
"functions": {
"predeploy": [
"npm --prefix \"$RESOURCE_DIR\" run lint",
"npm --prefix \"$RESOURCE_DIR\" run build"
]
},
"hosting": {
"public": "public",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
]
},
"emulators": {
"functions": {
"port": 5001
},
"firestore": {
"port": 8080
},
"hosting": {
"port": 5000
}
}
}

Firebase serve command gives HTTP Error: 500, Internal error encountered

I am a beginner on Firebase, I got a error when write command line "firebase serve".On the other hand, I can run "firebase deploy" command.Is this problem about OAuth 2.0 authentication ?
I am not developing ios, android app. I have been doing web site.
CLI Version: 3.18.4 , Platform: win32, Node Version: v8.11.1
[debug] [2018-05-04T04:00:08.420Z] ----------------------------------------------------------------------
[debug] [2018-05-04T04:00:08.423Z] Command: C:\Program Files\nodejs\node.exe C:\Users\ahmet\AppData\Roaming\npm\node_modules\firebase-tools\bin\firebase serve
[debug] [2018-05-04T04:00:08.423Z] CLI Version: 3.18.4
[debug] [2018-05-04T04:00:08.423Z] Platform: win32
[debug] [2018-05-04T04:00:08.423Z] Node Version: v8.11.1
[debug] [2018-05-04T04:00:08.423Z] Time: Fri May 04 2018 07:00:08 GMT+0300 (Turkey Standard Time)
[debug] [2018-05-04T04:00:08.423Z] ----------------------------------------------------------------------
[debug]
[debug] [2018-05-04T04:00:08.432Z] > 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"]
[debug] [2018-05-04T04:00:08.432Z] > authorizing via signed-in user
[debug] [2018-05-04T04:00:08.434Z] > refreshing access token with scopes: ["email","https://www.googleapis.com/auth/cloud-platform","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","openid"]
[debug] [2018-05-04T04:00:08.434Z] >>> HTTP REQUEST POST https://www.googleapis.com/oauth2/v3/token
{ refresh_token: '1/p1W5jdYn4PPSS0uPOTQt4K7qd_uw138yP26juNljNdPQ',
client_id: '56358434335869-fgrhgmd47bqnekij5i8b5pd03ho849e6.apps.googleusercontent.com',
client_secret: 'j9idda34334fs',
grant_type: 'refresh_token',
scope: 'email https://www.googleapis.com/auth/cloud-platform https://www.googleapis.com/auth/cloudplatformprojects.readonly https://www.googleapis.com/auth/firebase openid' }
Fri May 04 2018 07:00:08 GMT+0300 (Turkey Standard Time)
[debug] [2018-05-04T04:00:08.780Z] <<< HTTP RESPONSE 200
[debug] [2018-05-04T04:00:08.787Z] >>> HTTP REQUEST GET https://admin.firebase.com/v1/projects/database
Fri May 04 2018 07:00:08 GMT+0300 (Turkey Standard Time)
[debug] [2018-05-04T04:00:09.878Z] <<< HTTP RESPONSE 200
[debug] [2018-05-04T04:00:09.880Z] >>> HTTP REQUEST GET https://admin.firebase.com/v1/database/database/tokens
Fri May 04 2018 07:00:09 GMT+0300 (Turkey Standard Time)
[debug] [2018-05-04T04:00:10.761Z] <<< HTTP RESPONSE 200
[debug] [2018-05-04T04:00:10.764Z] >>> HTTP REQUEST GET https://cloudresourcemanager.googleapis.com/v1/projects/database
Fri May 04 2018 07:00:10 GMT+0300 (Turkey Standard Time)
[debug] [2018-05-04T04:00:11.902Z] <<< HTTP RESPONSE 200
[info]
[info] === Serving from 'C:\Projects\projectname'...
[info]
[info] i functions: Preparing to emulate functions.
[debug] [2018-05-04T04:00:13.307Z] Fetching environment
[debug] [2018-05-04T04:00:13.309Z] >>> HTTP REQUEST GET https://mobilesdk-pa.googleapis.com/v1/projects/330783331994:getServerAppConfig
Fri May 04 2018 07:00:13 GMT+0300 (Turkey Standard Time)
[debug] [2018-05-04T04:00:13.309Z] >>> HTTP REQUEST GET https://mobilesdk-pa.googleapis.com/v1/projects/330783331994/clients/_:getWebAppConfig
Fri May 04 2018 07:00:13 GMT+0300 (Turkey Standard Time)
[debug] [2018-05-04T04:00:14.091Z] <<< HTTP RESPONSE 200
[debug] [2018-05-04T04:00:14.093Z] Starting #google-cloud/functions-emulator
[debug] [2018-05-04T04:00:14.363Z] <<< HTTP RESPONSE 500
[debug] [2018-05-04T04:00:14.363Z] <<< HTTP RESPONSE BODY
[error]
[error] Error: HTTP Error: 500, Internal error encountered.
[debug] [2018-05-04T04:00:14.636Z] Error Context: {
"body": {
"error": {
"code": 500,
"message": "Internal error encountered.",
"status": "INTERNAL"
}
},
"response": {
"statusCode": 500,
"body": {
"error": {
"code": 500,
"message": "Internal error encountered.",
"status": "INTERNAL"
}
},
"headers": {
"vary": "X-Origin, Referer, Origin,Accept-Encoding",
"content-type": "application/json; charset=UTF-8",
"date": "Fri, 04 May 2018 04:00:14 GMT",
"server": "ESF",
"cache-control": "private",
"x-xss-protection": "1; mode=block",
"x-frame-options": "SAMEORIGIN",
"x-content-type-options": "nosniff",
"alt-svc": "hq=\":443\"; ma=2592000; quic=51303433; quic=51303432; quic=51303431; quic=51303339; quic=51303335,quic=\":443\"; ma=2592000; v=\"43,42,41,39,35\"",
"accept-ranges": "none",
"connection": "close"
},
"request": {
"uri": {
"protocol": "https:",
"slashes": true,
"auth": null,
"host": "mobilesdk-pa.googleapis.com",
"port": 443,
"hostname": "mobilesdk-pa.googleapis.com",
"hash": null,
"search": null,
"query": null,
"pathname": "/v1/projects/330783331994/clients/_:getWebAppConfig",
"path": "/v1/projects/330783331994/clients/_:getWebAppConfig",
"href": "https://mobilesdk-pa.googleapis.com/v1/projects/330783331994/clients/_:getWebAppConfig"
},
"method": "GET"
}
}
}

firebase-tools -- "Could not parse auth token"

I was wondering if someone could see if there is anything that I am doing that is obviously wrong with running the firebase cli jode.js tool. I've tried a few tokens (some generated by the login:ci and some generated by a normal login), all to no avail. It seems that some commands are working (list, init), but I cannot get the data:get command to work. This seems to be a problem with the "--token" option: if I login normally ("firebase login") I am able to execute the "data:get / -f rentette" command without any problem.
Any help would be much appreciated!!
(Below is the output of the failing command).
[~/$] firebase --token "-XXXXXjzTKnX9c_7qO|9546a9bc98f70f0b5b55ceb08ca23156" list
┌──────────────────┬──────┬────────────────────┐
│ Name │ Plan │ Collaborators │
├──────────────────┼──────┼────────────────────┤
│ rentette │ Free │ nick#xxxxx.net │
├──────────────────┼──────┼────────────────────┤
[~/$] firebase --token "-XXXXXjzTKnX9c_7qO|YYYYYYYYYYYYYYYY5ceb08ca23156" data:get / -f rentette --debug
----------------------------------------------------------------------
Command: /usr/bin/node /home/nhamilton/.npm-packages/bin/firebase --token -XXXXXjzTKnX9c_7qO|YYYYYYYYYYYYYYYY5ceb08ca23156 data:get / -f rentette --debug
Platform: linux
Node Version: v5.10.1
Time: Fri Apr 15 2016 11:31:20 GMT+1000 (AEST)
----------------------------------------------------------------------
Error: Could not parse auth token.
Error Context: {
"body": {
"error": "Could not parse auth token."
},
"response": {
"statusCode": 400,
"headers": {
"content-length": "46",
"content-type": "application/json; charset=utf-8",
"cache-control": "no-cache",
"strict-transport-security": "max-age=31556926; includeSubDomains; preload",
"connection": "close"
},
"request": {
"uri": {
"protocol": "https:",
"slashes": true,
"auth": null,
"host": "rentette.firebaseio.com",
"port": 443,
"hostname": "rentette.firebaseio.com",
"hash": null,
"search": "?auth=-XXXXXjzTKnX9c_7qO%7cYYYYYYYYYYYYYY5ceb08ca23156",
"query": "auth=-XXXXXjzTKnX9c_7qO%7cYYYYYYYYYYYYYY5ceb08ca23156",
"pathname": "/.json",
"path": "/.json?auth=-XXXXXjzTKnX9c_7qO%7cYYYYYYYYYYYYYY5ceb08ca23156",
"href": "https://rentette.firebaseio.com/.json?auth=-XXXXXjzTKnX9c_7qO%7cYYYYYYYYYYYYYY5ceb08ca23156"
},
"method": "GET",
"headers": {}
}
}
}
May I know that where is your token coming from? If you still use legacy firebase authentication token, please update your token. Cause right now we updated firebase auth SDK, so the old token should be generated by the new auth SDK, otherwise it won't work on new Firebase.

Resources