What does GET /bla - - ms - - mean in NodeJs console?
Asked Answered
L

3

7

When I go to the page /bla in my NodeJS app, the console prints out

GET /bla - - ms - -

In words (for easier Google searches), dash dash ms dash dash.

What does this mean?

Lactation answered 16/3, 2015 at 12:55 Comment(0)
H
2

This is the output from morgan, a HTTP request logger middleware for node.js.

It logs all requests, by default, to the console. Depending on your configurations it will display different data from the request.

If you are using the default format (dev), the data displayed is:

:method :url :status :response-time ms - :res[content-length]
Hausmann answered 16/3, 2015 at 13:2 Comment(2)
What could be the reason for such blank log?Coppage
This does not answer the questionLocklin
R
2

According to this thread:

The log line GET / - - ms - - is the dev format saying you never sent a response before Node.js killed the TCP connection for idling too long.

So the problem is a request that wasn't responded by the server - in other words, some middleware along the route never called next(), res.send(), res.end() or any other means to respond.

I realized that this can also occur if the server doesn't handle the client aborting the request (can be easily tested by e.g making the request through a browser and clicking on the X button in the address bar before it's done).

According to the docs, the way to handle that would probably be something like (wasn't tested):

req.on('abort', function (err) {
   if (err)
       console.error(error.message);

   // your code here
});
Reichenberg answered 11/12, 2019 at 14:7 Comment(0)
A
0

Maybe its a front issue, try postman see if you have the same issue

I had the same issue , but I observed that if I use my POSTMAN, the issue never pops up, but my react app at times returns correct request but most other times there was no response and POST /story/create - - ms - - was the express log. When I looked at the code, the form submission was very weird in the front rend

<Form onSubmit={() => formTest()}>
    <div
      style={{ display: "flex", justifyContent: "center" }}
      key={`inline-switch`}
      className="mb-3"
    >
      {checkboxes.map((name, index) => (
        <div key={index.toString()} className="mb-3">
          <Form.Check
            onChange={() => handleOnChange(index)}
            label={name}
            name="group1"
            type="switch"
            id={`inline-switch-${index}`}
          />
        </div>
      ))}
    </div>
    <div style={{ display: "grid", placeItems: "center" }}>
      <BootstrapButton
        style={{ backgroundColor: "Blue", width: "48%" }}
        type="submit"
      >
        Submit
      </BootstrapButton>

and when I cleaned it up

      <Form >
    <div
      style={{ display: "flex", justifyContent: "center" }}
      key={`inline-switch`}
      className="mb-3"
    >
      {checkboxes.map((name, index) => (
        <div key={index.toString()} className="mb-3">
          <Form.Check
            onChange={() => handleOnChange(index)}
            label={name}
            name="group1"
            type="switch"
            id={`inline-switch-${index}`}
          />
        </div>
      ))}
    </div>
    <div style={{ display: "grid", placeItems: "center" }}>
      <BootstrapButton
        style={{ backgroundColor: "Blue", width: "48%" }}
        onClick= {() => formTest()}
       
      >
        Submit
      </BootstrapButton>

The error no longer popped up. I don't know the reason nor I guarantee that this the real issue, but I suggest try to recreate by using CURL or postman or even other code like other react component's fetches. Maybe you can fix the issue

Alric answered 11/4, 2022 at 1:16 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.