mafintosh / turbo-http

Blazing fast low level http server
MIT License
1k stars 47 forks source link

Fatal error with basic Request handler #4

Open lukeed opened 6 years ago

lukeed commented 6 years ago

Hey~!

Just thought I'd drop by with this error quickly. Not really sure (yet) what's going on here, but hopefully this weekend I'll be able to poke through and find out.

The tiny code sample is here if you want to test it out locally. Polka passes its handler function, which is just a basic req,res signature, to the HTTP server. Polka relies on very basic Node APIs, the least common of which is probably res.finished. I imagine that everything else is already planned for compatibility, given how basic they are.

I think the pairing of Turbo & Polka would be great!!

(node:264) Warning: N-API is an experimental feature and could change at any time.
> Running on localhost:3000
/Users/lukee/.nvm/versions/node/v8.9.0/bin/node[264]: ../src/node_buffer.cc:212:char *node::Buffer::Data(Local<v8::Value>): Assertion `val->IsArrayBufferView()' failed.
 1: node::Abort() [/Users/lukee/.nvm/versions/node/v8.9.0/bin/node]
 2: node::(anonymous namespace)::DomainEnter(node::Environment*, v8::Local<v8::Object>) [/Users/lukee/.nvm/versions/node/v8.9.0/bin/node]
 3: node::Buffer::Data(v8::Local<v8::Object>) [/Users/lukee/.nvm/versions/node/v8.9.0/bin/node]
 4: napi_get_buffer_info [/Users/lukee/.nvm/versions/node/v8.9.0/bin/node]
 5: turbo_net_tcp_writev [/Users/lukee/repos/oss/polka/examples/with-turbo-http/node_modules/turbo-net/build/Release/turbo_net.node]
 6: (anonymous namespace)::v8impl::FunctionCallbackWrapper::Invoke(v8::FunctionCallbackInfo<v8::Value> const&) [/Users/lukee/.nvm/versions/node/v8.9.0/bin/node]
 7: v8::internal::FunctionCallbackArguments::Call(void (*)(v8::FunctionCallbackInfo<v8::Value> const&)) [/Users/lukee/.nvm/versions/node/v8.9.0/bin/node]
 8: v8::internal::MaybeHandle<v8::internal::Object> v8::internal::(anonymous namespace)::HandleApiCallHelper<false>(v8::internal::Isolate*, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::FunctionTemplateInfo>, v8::internal::Handle<v8::internal::Object>, v8::internal::BuiltinArguments) [/Users/lukee/.nvm/versions/node/v8.9.0/bin/node]
 9: v8::internal::Builtin_Impl_HandleApiCall(v8::internal::BuiltinArguments, v8::internal::Isolate*) [/Users/lukee/.nvm/versions/node/v8.9.0/bin/node]
10: 0x28ae488463d
error Command failed with signal "SIGABRT".
mafintosh commented 6 years ago

Ah yes. This is happening because you are passing a string instead of a buffer. We could easily support that though :)

lukeed commented 6 years ago

Ah gotcha. Now that you say it, the error makes sense :D

That would be great~! And I imagine the expected use for any Node developers