Anomaly in router.stack sorting
Hi Team,
I am experiencing an anomaly in the way stable sort is working on the router.stack object in server-app.js. On two different linux boxes I am getting different results. Find below the logs after sorting has been applied on router.stack object.
VM-Ware 1
[ { handle: { [Function: query] __NR_original: [Function: query] },
name: 'query',
params: undefined,
path: undefined,
keys: [],
regexp: { /^/?(?=/|$)/i fast_slash: true },
route: undefined,
phase: { builtin: true } },
{ handle: { [Function: expressInit] __NR_original: [Function: expressInit] },
name: 'expressInit',
params: undefined,
path: undefined,
keys: [],
regexp: { /^/?(?=/|$)/i fast_slash: true },
route: undefined,
phase: { builtin: true } },
{ handle: { [Function: favicon] __NR_original: [Function: favicon] },
name: 'favicon',
params: undefined,
path: undefined,
keys: [],
regexp: /(?:)/i,
route: undefined },
{ handle: { [Function: compression] __NR_original: [Function: compression] },
name: 'compression',
params: undefined,
path: undefined,
keys: [],
regexp: /(?:)/i,
route: undefined },
{ handle: { [Function] __NR_original: [Function] },
name: '
VM-Ware 2
[ { handle: [Function: query],
name: 'query',
params: undefined,
path: undefined,
keys: [],
regexp: { /^/?(?=/|$)/i fast_slash: true },
route: undefined,
phase: { builtin: true } },
{ handle: [Function: expressInit],
name: 'expressInit',
params: undefined,
path: undefined,
keys: [],
regexp: { /^/?(?=/|$)/i fast_slash: true },
route: undefined,
phase: { builtin: true } },
{ handle: [Function: favicon],
name: 'favicon',
params: undefined,
path: undefined,
keys: [],
regexp: /(?:)/i,
route: undefined,
phase: 'initial:before' },
{ handle: [Function: compression],
name: 'compression',
params: undefined,
path: undefined,
keys: [],
regexp: /(?:)/i,
route: undefined,
phase: 'initial' },
{ handle: [Function: mounted_app],
name: 'mounted_app',
params: undefined,
path: undefined,
keys: [],
regexp: /^/random-string/?(?=/|$)/i,
route: undefined },
{ handle: [Function: restApiHandler],
name: 'restApiHandler',
params: undefined,
path: undefined,
keys: [],
regexp: /^/api/?(?=/|$)/i,
route: undefined },
{ handle:
{ [Function: router]
params: {},
_params: [],
caseSensitive: undefined,
mergeParams: undefined,
strict: undefined,
stack: [Object] },
name: 'router',
params: undefined,
path: undefined,
keys: [],
regexp: { /^/?(?=/|$)/i fast_slash: true },
route: undefined },
{* handle: [Function],
name: '
I have highlighted the object which is causing this anomaly on VM- Ware 1 this object is coming before and on VM-Ware 2 this is coming after mounting the app because of which my api requests are being treated as static requests.
Let me know If more information is required.
I noticed that the phase property is missing for a few routes on VM-Ware1.
Yes, Raymond that does seem to be the root cause but the point is that with the same codebase and and same middleware config files phase property is coming on VM-Ware 2 but not on VM-Ware 1 and this is causing a lot of problems for us.
Can you make sure both installations have the exact same versions of dependencies? Can you try to zip up the app on VM-Ware2 and unzip it to VM-Ware1.
For clean npm install, you can do the following too:
1. npm cache clean
2. cd my-app
3. rm -f node_modules
4. npm install
Yes Raymond I already did that but still facing the same issue.
@blackvirus18 Can you please simplify your application to the point where you have a minimal example that reproduces the issues and that you can share with us? Without that, it's impossible for us to help you.
Hi @blackvirus18 Is that issue still persisting? Thanks.
hello,
closing this issue. If you are still running into problems, feel free to leave a comment and I will reopen the issue. Thanks