I've been experimenting with resumable.js and I've been very happy with the performance of its built-in node.js server on my laptop. However, it dies on anything over about 1MB when I deploy it to heroku or nodejitsu and get this error:
Poorly formatted HTTP response (heroku)
or
{"bytesParsed":9,"code":"HPE_INVALID_STATUS"} (nodejitsu)
How can I fix this so I can deploy?
Here's my package.json:
{
"name": "uploader-resumable",
"version": "0.0.1",
"dependencies": {
"express": "3.0.x"
},
"engines": {
"node": "0.8.x",
"npm": "1.1.x"
},
"subdomain": "blahblah",
"scripts": {
"start": "app.js"
}
}
I'm replying to this unanswered question because of its high search-rank when you search for the HPE_INVALID_STATUS error, even though it is a little old.
This error may occur when you're passing an invalid status code with the HTTP response from within nodeJS without checking for a valid status code, for instance an object instead of a number. (I've seen a lot of HTTP/1.1 [Object object] responses pass by when i was helping someone to debug this behaviour ...)
Poorly formatted HTTP response
is a specific response code returned from Heroku. Nodejitsu shouldn't be showing that error.
see: https://devcenter.heroku.com/articles/error-codes#h17-poorly-formatted-http-response
Related
I am trying to deploy Firebase functions project, on two different target projects on Firebase. One is in region "us-cenral" and the other one is "europe-west".
I'm using only functions and RTDB from Firebase, I don't have a need for "hosting".
At the start, I was having only one Firebase project region:"us-central" and I was able to deploy functions without problem. I have created another project recently in region:"europe-west" on the same billing account. And also in the local project I have added that another project using command:
firebase use --add project2
Since I didn't deploy functions for a couple of months and there was no need to check if deployment is still working on "project1" I have not checked if this functionally is working.
After adding "project2" I have issued command to deploy for the first time on another region.
When using command: "firebase deploy --only functions"
command ended with the following error:
There was an issue deploying your functions. Verify that your project has a Google App Engine instance setup at https://console.cloud.google.com/appengine and try again. If this issue persists, please contact support.
! functions: Upload Error: HTTP Error: 403, Permission denied on 'locations/null' (or it may not exist).
Error: HTTP Error: 403, Permission denied on 'locations/null' (or it may not exist).
[2022-05-11T19:32:17.580Z] Error Context: {
"body": {
"error": {
"code": 403,
"message": "Permission denied on 'locations/null' (or it may not exist).",
"status": "PERMISSION_DENIED"
}
},
"response": {
"statusCode": 403
}
}
Switching back to project1 and trying to deploy the same thing, I got the same error.
So now I'm stuck. Does anyone have experience with this problem and how to overcome it.
Google support suggest to create "App Engine application", I cannot see how this can help as I didn't had that thing in the 1st place and everything was working. Now with the second project I have this error that suggest permissions problem. Since I have OWNER account on both of these projects what could be wrong?
What I have done so far:
installed the latest firebase tools (same problem)
defined default region on both projects (as stated above)
checked that I'm logged with the OWNER account (also switched between different owner account but the same issue)
checked permissions and din't find anything useful
default service accounts exist on both projects with rights
visited suggested link: https://console.cloud.google.com/appengine
on both projects (and still have the same error although not sure if I need to deploy?!? - I don't have anything there to deploy or do I?)
Config package.json:
{
"name": "functions",
"description": "Cloud Functions for Firebase",
"engines": {
"node": "10"
},
"dependencies": {
"canvas": "^2.6.1",
"firebase-admin": "^10.2.0",
"firebase-functions": "^3.21.0",
"jsbarcode": "^3.11.0",
"qrcode": "^1.4.4"
},
"devDependencies": {
"eslint": "^5.16.0",
"eslint-plugin-promise": "^4.0.1",
"firebase-functions-test": "^0.2.0"
},
"private": true
}
Configuration didn't changed from the 1st deploy to project1 when everything was working fine.
At the end I found out the reason for my problem, and posting just to help the others if they end up with the same error.
The problem was not deployment script "per se" but the function that was connected to fetch data from RTDB on the project. Method "region" was supposed to get configured "region(fnRegion)" value, but that variable value was "null" and resulted with the error posted above during deployment.
function selectDatabaseReference(path = '/') {
return functions
.region(fnRegion) // Sets function region
.database
.ref(path); // Sets database reference path
}
It would be nice if I could get more descriptive error to the real cause of the error (I'm not truly sure, what would be the content of that error message though).
Anyway it's good I was not able to deploy functions because of this.
Deploying our Firebase Function suddenly stopped working recently. Running firebase functions:log provided an insight that was not very helpful:
2022-02-15T06:53:12.421579Z E XXX:
{"#type":"type.googleapis.com/google.cloud.audit.AuditLog","status":{"code":3,"message":"Build
failed: curl: (22) The requested URL returned error: 404 \n\ngzip:
stdin: unexpected end of file\ntar: Child returned status 1\ntar:
Error is not recoverable: exiting now; Error ID:
08522105"},"authenticationInfo":{"principalEmail":"XXXX"},"serviceName":"cloudfunctions.googleapis.com","methodName":"google.cloud.functions.v1.CloudFunctionsService.UpdateFunction","resourceName":"XXXX"}
The deployment works fine for other projects, but fails even for older versions of this project (ones that have been deployed successfully in the past).
I received a 404 error from gcloud.functions.deploy on deploy:
Deploying function (may take a while - up to 2 minutes)...
.
For Cloud Build Stackdriver Logs, visit: https://console.cloud.google.com/logs/viewer?project=x-xxx-dev&advancedFilter=resource.type%3Dbuild%0Aresource.labels.build_id%3D35aac420-xx-4cd1-b7be-blah%0AlogName%3Dprojects%2Fxxx-xxx-dev%2Flogs%2Fcloudbuild
................failed.
ERROR: (gcloud.functions.deploy) OperationError: code=3, message=Build failed: curl: (22) The requested URL returned error: 404
The root cause error is not visible here, but if you click on the Stackdriver logs link in the console output, there will be more details. In my case, the root error was that yarn 2.4.3 couldn't be downloaded # https://github.com/yarnpkg/yarn/releases/download/v2.4.3/yarn-v2.4.3.tar.gz
I did not expect to be using yarn 2 (berry) at this point, but in my package.json I was not explicit:
"engines": {
...
"yarn": ">=1.22.0"
},
By changing to accept only version 1, the problem was resolved:
"engines": {
...
"yarn": "^1.22.0"
},
I still don't understand why npm resolved this missing version.
The firebase log was not useful at all, but since Functions are built using "Google Cloud Build" I was able to get more insight into what's wrong by opening the Logs Explorer in Google Cloud Console. Select the resource type "Cloud Build" and there you will find logs of each build step and which one failed.
In this case, it fails to fetch the yarn-version specific in our package.json (1.22). Changing it to "1.22.17" (latest as of now) fixed the build.
"engines": {
"node": "14",
"npm": "8.1",
"yarn": "1.22.17"
},
This drives me crazy - I'm getting the below error during firebase deploy (click the image to enlarge):
package.json
{
"engines": {
"node": "10"
},
"main": "src/index.js",
...
}
The index.js does exist under the src folder.
I tried to change the path in "main" to a fake path and then it fails before deployment which is expected.
However with the "main": "src/index.js" it actually starts to deploy and fails much later during the process as shown on the screenshot above.
What am I missing here?
I'm using firebase-tools v8.12.0
Please, check build steps and your functions configuration in firebase.json.
I have come onto a project that has had an ARM deployment via templates running for a number of months now, and until recently everything was working without issue:
Successful deployments
But then, something changed and most (but not all) deployments began failing:
Unsuccessful deployments
The error reported is:
{
"code": "Conflict",
"message": "Conflicting changes were detected when processing the request. This can happen when there are multiple requests trying to update one profile at the same time. Please retry your request."
}
Yet this is the only deploy running at the time. For now I've managed to stave off the issue by adding a dependsOn to the traffic manager resource:
{
"apiVersion": "2015-11-01",
"type": "Microsoft.Network/trafficManagerProfiles",
"name": "[variables('traffic-manager-name')]",
"location": "global",
"properties": {
"profileStatus": "Enabled",
"trafficRoutingMethod": "Priority",
"dnsConfig": {
"relativeName": "[variables('traffic-manager-name')]",
"ttl": 30
},
"monitorConfig": {
"protocol": "HTTP",
"port": 80,
"path": "/"
},
"endpoints": [
{
"name": "[variables('traffic-manager-endpoint')]",
"type": "Microsoft.Network/trafficManagerProfiles/azureEndpoints",
"properties": {
"endpointStatus": "Enabled",
"targetResourceId": "[resourceId('Microsoft.Web/sites', variables('web-app-name'))]",
"target": "[concat(variables('web-app-name'), '.azurewebsites.net')]",
"weight": 1,
"priority": 1,
"endpointLocation": "[resourceGroup().location]"
}
}
]
},
"dependsOn": [
"[resourceId('Microsoft.Web/Sites', variables('web-app-name'))]"
]
}
But I am concerned that doing so may simply be obfuscating a genuine issue that still needs addressing. If anyone knows any more about that error, or why it might have just started happening out of nowhere, I'd love to know!
When using ARM template to deploy traffic manager, it returns with 409 conflict error "Conflicting changes were detected when processing the request. This can happen when there are multiple requests trying to update one profile at the same time. Please retry your request." because the ARM template deployments are aimed at creating new resources hence it use PUT requests. If the traffic manager profile already exists, it will return when the template makes a change that would alter or affect existing profiles. Before deployment, there was a traffic manager created, thus the template failed with conflict error. To resolve or overcome the issue make sure that no TM profile created before the ARM deployment. Then retest the deployment.
Hope this helps! Cheers!
I have problem with AWS Lambda function deployment with Serverless Framework. I use #google-cloud-firestore npm package which requires grpc package.
Function execution throws error:
{
"errorMessage": "Failed to load gRPC binary module because it was not installed for the current system\nExpected directory: node-v48-linux-x64-glibc\nFound: [node-v59-darwin-x64-unknown]\nThis problem can often be fixed by running \"npm rebuild\" on the current system\nOriginal error: Cannot find module '/var/task/node_modules/grpc/src/node/extension_binary/node-v48-linux-x64-glibc/grpc_node.node'",
"errorType": "Error",
"stackTrace": [
"Found: [node-v48-linux-x64-unknown]",
"This problem can often be fixed by running \"npm rebuild\" on the current system",
"Original error: Cannot find module '/var/task/node_modules/grpc/src/node/extension_binary/node-v48-linux-x64-glibc/grpc_node.node'",
"Object.<anonymous> (/var/task/node_modules/grpc/src/grpc_extension.js:44:17)",
"Module._compile (module.js:570:32)",
"Object.Module._extensions..js (module.js:579:10)",
"Module.load (module.js:487:32)",
"tryModuleLoad (module.js:446:12)",
"Function.Module._load (module.js:438:3)",
"Module.require (module.js:497:17)",
"require (internal/module.js:20:19)",
"Object.<anonymous> (/var/task/node_modules/grpc/src/client.js:38:12)",
"Module._compile (module.js:570:32)",
"Object.Module._extensions..js (module.js:579:10)",
"Module.load (module.js:487:32)",
"tryModuleLoad (module.js:446:12)",
"Function.Module._load (module.js:438:3)",
"Module.require (module.js:497:17)",
"require (internal/module.js:20:19)"
]
}
So, as I understood, lambda requires grps built with target node-v48-linux-x64-glibc
Typing npm i -S grpc --target=6.4.0 --target_arch=x64 --target_platform=linux has only changed node-v59-darwin-x64-unknown to node-v48-linux-x64-unknown.
How can I change unknown to glibc?
Any help would be really appreciated!
Fix
Basically, you need to specify the target of the grcp library.
Copied from that link:
{
"main": "index.js",
"scripts": {
"postinstall": "npm rebuild grpc --target=6.1.0 --target_arch=x64 --target_platform=linux --target_libc=glibc"
}
}
I got something similar to work by including a --target_libc=glibc, found in the documentation for node-pre-gyp.