Giter Site home page Giter Site logo

Does not work with node v6.5 about convert HOT 8 CLOSED

koajs avatar koajs commented on May 4, 2024 2
Does not work with node v6.5

from convert.

Comments (8)

targos avatar targos commented on May 4, 2024 4

This is a bug in V8 with tail call optimization. The --harmony-tailcalls flag (implied by --harmony) is enough to trigger it. It will probably not be fixed in Node.js because the feature is not considered stable in V8 5.1.
I suggest you drop the --harmony flag and if you really need one of the features that it activates, enable it directly. Here is the list: https://github.com/nodejs/node/blob/v6.5.0/deps/v8/src/flag-definitions.h#L211-L216

from convert.

bishtawi avatar bishtawi commented on May 4, 2024 3

Did some more testing. Its due to the --harmony flag that I am including when running node.

Smallest failing test case:

const Koa = require('koa')
const convert = require('koa-convert')
const session = require('koa-generic-session')

const app = new Koa()
app.use(convert(session()))

app.listen(3000)

Running node --harmony index.js then hitting localhost:3000 in a webbrowser returns a 500 instead of the expected 404.

Running without the harmony flag works as expected.

from convert.

bishtawi avatar bishtawi commented on May 4, 2024

Adding @targos

from convert.

gyson avatar gyson commented on May 4, 2024

Which version do you use ? (for koa, koa-convert & koa-generic-session)

from convert.

bishtawi avatar bishtawi commented on May 4, 2024

Ah, good question. I should have mentioned it in my original post.

Koa: 2.0.0
Koa-convert: 1.2.0
Koa-generic-session: 1.11.3

from convert.

gyson avatar gyson commented on May 4, 2024

Thanks for the detailed report. The stacktrace looks a little bit strange. It basically says that calling generator.next() will return undefined instead of { done, result } protocol. I think it's more likely to be a nodejs/V8 bug.

Also, --harmony flag is usually not suitable for production.

from convert.

bishtawi avatar bishtawi commented on May 4, 2024

Thanks everyone. I removed the harmony flag and my app works fine. Looks like the only reason why I had it was due to needing it back in the old node 0.12.x to get generators, arrow functions, promises, block scoping, etc.

from convert.

bishtawi avatar bishtawi commented on May 4, 2024

Closing as its a bug in V8

from convert.

Related Issues (8)

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.