Skip to content
This repository has been archived by the owner on Nov 16, 2023. It is now read-only.

exception of TypeError 'The header content contains invalid characters' #67

Open
alanywlee opened this issue Jan 30, 2018 · 1 comment

Comments

@alanywlee
Copy link

I followed README instruction both in root and samples/browser directory to run
a server by "node sample-server.js enableTunnel" command, and trying to test by
speak some utterance. However my server always crashed by exception of TypeError
'The header content contains invalid characters' .

The following is the error message of crashed server:

Incoming request:/
Incoming request:/distrib/speech.sdk.bundle.js
Incoming request:/robots.txt?1517283192388
Incoming request:/favicon.ico
Incoming request:/token
_http_outgoing.js:359
    throw new TypeError('The header content contains invalid characters');
    ^

TypeError: The header content contains invalid characters
    at ClientRequest.OutgoingMessage.setHeader (_http_outgoing.js:359:11)
    at new ClientRequest (_http_client.js:85:14)
    at Object.exports.request (http.js:31:10)
    at Object.exports.request (https.js:202:15)
    at getToken (D:\JavaScript\SpeechToText-WebSockets-Javascript\samples\browser\sample-server.js:119:35)
    at Server.<anonymous> (D:\JavaScript\SpeechToText-WebSockets-Javascript\samples\browser\sample-server.js:43:9)
    at emitTwo (events.js:106:13)
    at Server.emit (events.js:191:7)
    at HTTPParser.parserOnIncoming [as onIncoming] (_http_server.js:546:12)
    at HTTPParser.parserOnHeadersComplete (_http_common.js:99:23)

PS: my node version is v6.11.3

@raaaar
Copy link
Contributor

raaaar commented Feb 7, 2018

Could you check if your speech.key contains any special symbols/whitespaces (cat -T speech.key). If it does not, make sure it's encoded using ascii:

> file -i speech.key
speech.key: text/plain; charset=us-ascii

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

No branches or pull requests

2 participants