Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crashing after first request #4

Open
jenswachtel opened this issue Mar 17, 2015 · 8 comments
Open

Crashing after first request #4

jenswachtel opened this issue Mar 17, 2015 · 8 comments
Assignees
Labels

Comments

@jenswachtel
Copy link

I unfortunately can't get it to run stable.
Error:
_http_outgoing.js:333 throw new Error('"name" and "value" are required for setHeader().'); ^ Error: "name" and "value" are required for setHeader(). at ServerResponse.OutgoingMessage.setHeader (_http_outgoing.js:333:11) at Request._callback (/Users/jwachtel/projects/data/hanatrial-auth-proxy-master/server-basic-auth.js:85:18) at Request.self.callback (/Users/jwachtel/projects/data/hanatrial-auth-proxy-master/node_modules/request/request.js:344:22) at Request.emit (events.js:110:17) at Request.<anonymous> (/Users/jwachtel/projects/data/hanatrial-auth-proxy-master/node_modules/request/request.js:1239:14) at Request.emit (events.js:129:20) at IncomingMessage.<anonymous> (/Users/jwachtel/projects/data/hanatrial-auth-proxy-master/node_modules/request/request.js:1187:12) at IncomingMessage.emit (events.js:129:20) at _stream_readable.js:908:16 at process._tickCallback (node.js:355:11)

This happens every time after the first request got returned successfully. Meaning I'll retrieve e.g. the ODATA service object but right after the program crashes with the above output.

Tried Firefox & Chrome
Using latest node. I also tried different versions of your code with the same effect.

Any idea what I am doing wrong?

Thanks,
Jens

@gregorwolf
Copy link
Owner

Hi Jens,

for a more detailed analysis of the issue it would help if you could provide the payload sent & retrieved from your Browser including the HTTP headers you send & retrieve. Or if your service is not confidential provide me access to the service for my S-User S0001142741. So I can give it a try.

Best regards
Gregor

@gregorwolf gregorwolf added the bug label Mar 17, 2015
@gregorwolf gregorwolf self-assigned this Mar 17, 2015
@jenswachtel
Copy link
Author

Hi Gregor,

thanks for this awesome tool first!
It actually runs perfectly if I consume it through a HTML5 app. It only fails when I call a service directly from the browser. (e.g. an ODATA service)
(http://localhost:7891/p1789354563trial/opennyc/DOHMH/dohmh.xsodata/RESTAURANTS/?$top=1&$format=json) => crashes hanatrial-auth-proxy-master after a successful load.

Here's my request:
localhost_7891_p1789354563trial_opennyc_dohmh_dohmh_xsodata_restaurants___top_1__format_json

with a clean response:
{"d":{"results":[{"__metadata": {"uri":"https://s6hanaxs.hanatrial.ondemand.com:443/p1789354563trial/opennyc/DOHMH/dohmh.xsodata/RESTAURANTS(1)","type":"DOHMH_Data.service.RESTAURANTSType"},"CAMIS":"4.0395079E7","DBA":"RUDY'S BAR & Grill","BORO":"MANHATTAN","BUILDING":"627","STREET":"9 AVENUE","ZIPCODE":10036,"PHONE":"6.46707089E9","CUISINE_ID":3,"RESTAURANT_ID":1}]}}

My console output:
console

After "Get new session cookie", it takes around 1-2 seconds and then it exists with the stacktrace.
I didn't dig in since it seems to work perfectly fine when I work with the WEB IDE and actually consume it into a table.

Maybe that helps?

Let me know If I should provide more details

Thanks,
Jens

@gregorwolf
Copy link
Owner

Hi Jens,

the console output helped. As you see the OData call is not the last call. The problem actually occurs with the call to http://localhost:7891/favicon.ico which is automatically done by the browsers to request an icon for favorites. I was able to repeat the problem:

GET /favicon.ico
Get new session cookie

TypeError: Cannot read property 'headers' of undefined
    at Request._callback (/Users/gwolf/Documents/hanatrial-auth-proxy-s0001142741/hana-saml.js:39:31)
    at self.callback (/usr/local/lib/node_modules/request/request.js:344:22)
    at Request.emit (events.js:95:17)
    at Request.init (/usr/local/lib/node_modules/request/request.js:358:17)
    at new Request (/usr/local/lib/node_modules/request/request.js:264:8)
    at request (/usr/local/lib/node_modules/request/index.js:50:10)
    at Function.request.get (/usr/local/lib/node_modules/request/index.js:63:27)
    at Request._callback (/Users/gwolf/Documents/hanatrial-auth-proxy-s0001142741/hana-saml.js:38:24)
    at Request.self.callback (/usr/local/lib/node_modules/request/request.js:344:22)
    at Request.emit (events.js:98:17)

now I can try to fix it.

Thanks for the provided details.

Best regards
Gregor

@gregorwolf
Copy link
Owner

I've tried to reproduce the error but wasn't able to get it any more. Seems that the improvements by @mlenkeit have fixed this issue. Please give it a try and close the issue when you can confirm.

@SteffenGa
Copy link

Hi guys, hi gregor,

first also a big thanks for sharing this great piece of software, which is very helpful for some nice tutorials with the HCP trial version!

I work currently with your newest release (downloaded today), but I still get the same error by loading a favicon.ico via a Browser request. Just to remind here, that the problem still occurs...

Thanks and regards
Steffen

@gregorwolf
Copy link
Owner

Hi Steffen,
which OS do you use? I've tested successfully on Mac OS X and Debian on the Raspberry Pi.
Best regards
Gregor

@SteffenGa
Copy link

Hi Gregor,

I'm using Windows 7 Enterprise x64 (SP1) and GoogleChrome Version 41.0.2272.118 m. But the problem also happens in Firefox and IE.

For my main use case to connect a UI5 to backend data, everything works fine and stable. Just if I do some manual checks with Browser URLs in Chrome (and a favicon.ico is requested), the problem occurs.

Best regards
Steffen

gregorwolf added a commit that referenced this issue Apr 7, 2015
@gregorwolf
Copy link
Owner

Hi Steffen,
I was able to reproduce the issue on Windows 8 with node v0.12.2. I've added some more error handling. Please update and try again.
Best regards
Gregor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants