Code Monkey home page Code Monkey logo

Comments (9)

dougwilson avatar dougwilson commented on June 7, 2024

Hi @tkxkd0159 that is very strange. When morgan tries to write to the stream, it does not wait for the write to complete before continuing, and even then morgan does not write until after the response is completed. I tried with a basic app without issue.

Can you please provide an app that demonstrates the issue and include instructions for how to trigger the condition with the given app? We would be happy to debug the issue. Alternatively you're welcome to make a pull request that fixes the issue.

from morgan.

tkxkd0159 avatar tkxkd0159 commented on June 7, 2024

Thanks for your quick feedback @dougwilson !
My original repository where the problem occurred required several complicated setup processes, so I made a dummy repository that had similar problems (refresh issue). I made a simple example app that separates the backend and the front, and if you press the button called check morgan bug, the bug is reproduced (Page is refreshed again for current location after receiving a response with fetch). You can also check this with chrome network tab

The address of the source is here. => https://github.com/tkxkd0159/debug-morgan

from morgan.

dougwilson avatar dougwilson commented on June 7, 2024

Hi @tkxkd0159 thanks for that! Are you sure the bug is due to morgan? I ask because in the reproduction code you provided, you have morgan commented out. If you are able to reproduce with that given app, it would seem the issue is unrelated to morgan.

https://github.com/tkxkd0159/debug-morgan/blob/759ab6c3b4b0b35a19568c63f71be05b0b85a653/src/app.ts#L51

from morgan.

tkxkd0159 avatar tkxkd0159 commented on June 7, 2024

Hi @dougwilson, sorry I forget to uncomment app.use(morgan("common", { stream: accessLogStream }));
so this code works fine (no bug). but when you uncomment morgan part, bus is reproduced.

from morgan.

dougwilson avatar dougwilson commented on June 7, 2024

Thanks. I guess I should clarify that I tried that, and your app acted the same if I had it commented out or not, so I wasn't sure if you were able to reproduce with that app. If that is the case, it seems that for some reason I am unable to reproduce on my system and unfortunately won't be able to help produce a fix without reproducing. You'll need to debug what the cause is and make a pull request with a fix 👍 , as it may be dependent on perhaps something on the system itself.

from morgan.

tkxkd0159 avatar tkxkd0159 commented on June 7, 2024

Thanks @dougwilson. For reference, my environment was Ubuntu 20.04.4 LTS. I'll try to debug this problem.

from morgan.

tkxkd0159 avatar tkxkd0159 commented on June 7, 2024

I tried to check issue this my mac (Monterey 12.4) and WIndows 10 machine. And there was no bug with morgan. Maybe there is something wrong with my linux machine or just compatible issue with Ubuntu focal. I will try to check this.
Thanks

from morgan.

dougwilson avatar dougwilson commented on June 7, 2024

Ah, very interesting. And sorry for not including it, I was using Windows 11.

from morgan.

tkxkd0159 avatar tkxkd0159 commented on June 7, 2024

I tried to test with linux docker container and it works fine. Maybe there is something wrong with my local linux machine. There doesn't seem to be a problem with that package, and it seems to be a problem with my computer. Sorry for raising the wrong issue. I'll close this issue now that the issue has been resolved.

from morgan.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.