pnxtech / hydra-express Goto Github PK
View Code? Open in Web Editor NEWA module which wraps Hydra and ExpressJS into a library for building distributed applications - such as microservices
License: MIT License
A module which wraps Hydra and ExpressJS into a library for building distributed applications - such as microservices
License: MIT License
An error in my Node JS application is throwing a hydra-express related exception (and covering up the real issue on my end):
TypeError: this.appLogger.fatal is not a function
at /usr/src/app/node_modules/hydra-express/index.js:487:26
at Layer.handle_error (/usr/src/app/node_modules/express/lib/router/layer.js:71:5)
at trim_prefix (/usr/src/app/node_modules/express/lib/router/index.js:315:13)
at /usr/src/app/node_modules/express/lib/router/index.js:284:7
at Function.process_params (/usr/src/app/node_modules/express/lib/router/index.js:335:12)
at next (/usr/src/app/node_modules/express/lib/router/index.js:275:10)
at Layer.handle_error (/usr/src/app/node_modules/express/lib/router/layer.js:67:12)
at trim_prefix (/usr/src/app/node_modules/express/lib/router/index.js:315:13)
at /usr/src/app/node_modules/express/lib/router/index.js:284:7
at Function.process_params (/usr/src/app/node_modules/express/lib/router/index.js:335:12)
at next (/usr/src/app/node_modules/express/lib/router/index.js:275:10)
at Layer.handle_error (/usr/src/app/node_modules/express/lib/router/layer.js:67:12)
at trim_prefix (/usr/src/app/node_modules/express/lib/router/index.js:315:13)
at /usr/src/app/node_modules/express/lib/router/index.js:284:7
at param (/usr/src/app/node_modules/express/lib/router/index.js:354:14)
at param (/usr/src/app/node_modules/express/lib/router/index.js:365:14)
Based on the trace, I believe the culprit is here:
Line 487 in b487120
this.log('fatal', {msg})
instead.
We are running with the following dependencies:
"dependencies": {
"redis": "2.8.0",
"hydra-express": "1.8.3",
"hydra-express-plugin-jwt-simple-auth": "0.1.0",
"hydra-plugin-hls": "0.2.6",
"node-fetch": "2.6.1"
},
It seems that hydra can't handle the HTTP-StatusCode 403. Whenever I try to send this status it defaults to 503, which means the service is unavailable (which is not true).
The reason for this seems to be that the key '403' doesn't exist in the ServerResponse.STATUS-object in the server-response.js-file. Therefore the createResponseObject function throws an error (because it tries to access the object at a key that does not exist) and the response defaults to 503 in the catch-block of _tryAPIRequest.
Is there any workaround for this?
I'm currently having problems with the use of body-parser, because I'm trying to upload some files that are ~1MB.
Because of the fact, that the bodyParser (specifically the json-parser) is initialized with its default values in the index.js file, the allowed request size is always the default (which is 100KB) and therefore I keep getting "Request Entity Too Large"-Errors. There doesn't seem to be any way to reset this limit inside my own code.
Has anyone had this issue before?
In my opinion, a solution for this issue could be to add the body-parser config parameters to the config.json-file and then take them from there (if present).
Please let me know your thoughts on this.
Posting to services with non-latin chars in payload/body brakes them. Issue was in express 4.15.2 and already fixed in 4.15.3 (http://expressjs.com/en/changelog/4x.html#4.15.3). Could you please update the express version?
We opened an issue in hydra
project (pnxtech/hydra#207) to know how to disable Redis connection to a small project.
Looking at the hydra documentation I find'd the testMode property and when that property is enabled is possible to use redis-mock. But, when using that enabled property, we receive this error:
node_modules/hydra/index.js:848
.select(HYDRA_REDIS_DB)
^
TypeError: this.redisdb.multi(...).select is not a function
My hydra-express
version is 1.5.5
@cjus any idea?
Thanks.
Hi,
Thanks for sharing this awesome library!
I'm starting migrating our node cluster application to microservices.
Our app uses express with node cluster, so we have 5+ workers running with express framework.
https://nodejs.org/api/cluster.html
Thank you
Hello,
I'm trying this sample, and the callback seems to be called 2 times (it displays 2 ๐)
const hydraExpress = require('fwsp-hydra-express');
const config = require('./config.json');
hydraExpress.init(config, () => {
console.log("๐")
const express = hydraExpress.getExpress();
const api = express.Router();
api.get('/', function(req, res) {
res.send({
msg: `hello from ${hydra.getServiceName()} - ${hydra.getInstanceID()}`
});
});
hydraExpress.registerRoutes({
'': api
});
});
Hi
Looking for ssl configuration with hydra, Is it possible to configure ssl certificates?
These entries in the package.json files and any related code in index.js
"bunyan": "1.8.4",
"bunyan-loggly": "1.1.0",
"bunyan-logstash-tcp": "0.3.4",
"bunyan-prettystream": "0.1.3",
Getting this error....Need some sample test cases pls. Really tried to delete node_modules and installed again as suggested in forums and didnt work out..Got stucked with this..
C:\Hackathon\Samaritan\dashboard-service>npm test
[email protected] test C:\Hackathon\Samaritan\dashboard-service
mocha specs --reporter spec
C:\Hackathon\Samaritan\dashboard-service\node_modules\yargs\yargs.js:1163
else throw err
^
TypeError [ERR_INVALID_ARG_TYPE]: The "id" argument must be of type string. Received type object
at Module.require (internal/modules/cjs/loader.js:631:11)
at require (internal/modules/cjs/helpers.js:22:18)
at Object. (C:\Hackathon\Samaritan\dashboard-service\specs\test.js:22:13)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)
at C:\Hackathon\Samaritan\dashboard-service\node_modules\mocha\lib\mocha.js:330:36
at Array.forEach ()
at Mocha.loadFiles (C:\Hackathon\Samaritan\dashboard-service\node_modules\mocha\lib\mocha.js:327:14)
at Mocha.run (C:\Hackathon\Samaritan\dashboard-service\node_modules\mocha\lib\mocha.js:804:10)
at Object.exports.singleRun (C:\Hackathon\Samaritan\dashboard-service\node_modules\mocha\lib\cli\run-helpers.js:207:16)
at exports.runMocha (C:\Hackathon\Samaritan\dashboard-service\node_modules\mocha\lib\cli\run-helpers.js:300:13)
at Object.exports.handler.argv [as handler] (C:\Hackathon\Samaritan\dashboard-service\node_modules\mocha\lib\cli\run.js:296:3)
at Object.runCommand (C:\Hackathon\Samaritan\dashboard-service\node_modules\yargs\lib\command.js:242:26)
at Object.parseArgs [as _parseArgs] (C:\Hackathon\Samaritan\dashboard-service\node_modules\yargs\yargs.js:1087:28)
at Object.parse (C:\Hackathon\Samaritan\dashboard-service\node_modules\yargs\yargs.js:566:25)
at Object.exports.main (C:\Hackathon\Samaritan\dashboard-service\node_modules\mocha\lib\cli\cli.js:63:6)
at Object. (C:\Hackathon\Samaritan\dashboard-service\node_modules\mocha\bin_mocha:10:23)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:742:12)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:743:3)
npm ERR! Test failed. See above for more details.
Through Hydra Cli rest, we can see its load balancing and sending requests to running instances. But in typical web application to call hydra services, how can i configure to call with domain we specify without port?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.