Giter Site home page Giter Site logo

Comments (8)

pmbanugo avatar pmbanugo commented on May 24, 2024 1

I think I found why it isn't working. There was a recent PR that reverted some changes wrongfully, which was was got applied to 9.4.1. You can stick to 9.4.0 or wait until there's a new major release in the coming days/weeks.

It should be resolved in the next 9.5 release.

from micro.

pmbanugo avatar pmbanugo commented on May 24, 2024

When you run it locally what kind of errors do you get?

from micro.

samarjit avatar samarjit commented on May 24, 2024

This is reproduceable even in local laptop environment
docker pull public.ecr.aws/docker/library/node:16.16-alpine
docker run -dit

Open a terminal and log into container:
docker exec sh

Run inside container npm i [email protected]
I took the below examples from documentation.

~ # cat > test.js
module.exports = () => {
console.log('server accepted connection');
'Welcome to Micro';
}

node_modules/.bin/micro test.js

Open another terminal and run curl localhost:3000 it gets stuck, even the console log 'server accepted connection' does not gets printed. . If curl is not installed by default run apk add curl.
Some more hint into the issue - If I kill the micro server at this point, then curl says empty response returned from server:

/ # curl http://localhost:3000
curl: (52) Empty reply from server

Another example same symptoms.

~ # cat send.js
const {send} = require('micro')

module.exports = async (req, res) => {
  const statusCode = 400
  const data = { error: 'Custom error message' }

  send(res, statusCode, data)
}

Same thing happens if you run node_modules/.bin/micro send.js.

If you want to compare against 9.4.0 both of the above examples runs fine in 9.4.0. Just run npm i [email protected] and try rest of the steps they all passes.

Note: I ran docker using docker desktop and I have windows 10 machine, but that should not matter.

from micro.

electerious avatar electerious commented on May 24, 2024

This isn't just alpine related. I've tried micro with Node.js v14, v16 and v18 on macOS. Non of them worked with 9.4.1. Downgrading to 9.4.0 fixes the issue. This even effects simple code examples from the README (module.exports = () => 'Welcome to Micro';) when you use the micro CLI.

from micro.

pmbanugo avatar pmbanugo commented on May 24, 2024

@electerious As I said in the previous comment, there's an issue with 9.4.1 and I wouldn't recommend using it. Stick to 9.4.0 for the moment 😄

from micro.

ranrao avatar ranrao commented on May 24, 2024

I seem to run into the same issue with 9.4.0 with NodeJS v12. Could anyone please share an example of a Dockerfile to ensure I have it right?

Running curl localhost:3000 gets stuck in the pod. Please help.

from micro.

samarjit avatar samarjit commented on May 24, 2024

from micro.

leerob avatar leerob commented on May 24, 2024

The code has been significantly changed with v10. Please reopen or create a new issue with a reproduction is you are still seeing this issue on v10. Thanks!

from micro.

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.