vercel / micro

Asynchronous HTTP microservices
MIT License
10.59k stars 459 forks source link

Bring back default http server wrapper #460

Closed walaszczykm closed 2 years ago

walaszczykm commented 2 years ago

The micro has a breaking change in its minor version upgrade from 9.3.4 to 9.4.0 related not to default wrapping the "serve" function result into http.Server instance, which leads to "server.listen is not a function" error.

The difference can be seen by comparing the source and README:

This PR proposes reverting this part of the code and readme to the state from version 9.3.4

walaszczykm commented 2 years ago

Hey @leerob, sorry for the confusion, I saw that tests are hanging ad dug a little bit into why. Turns out the _test-utils.js was wrapping micro into new http.Server instance. I have adjusted it accordingly.

I feel quite hesitantly as those are changes from 3 years ago, and now I am reverting them, but I see they all were all rolled out as a canary release until now, the new 9.4.0 version. If you feel that this new way of consuming micro programmatically is better suited, then maybe going with it in a dedicated major release would also be an option.

Bessonov commented 2 years ago

From my point of view, it would be nice to get rid of http.Server. It makes micro usable with another implementations like https.createServer.