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

SyntaxError: Unexpected token S #159

Closed
sandrocsimas opened this issue Jun 21, 2014 · 12 comments
Closed

SyntaxError: Unexpected token S #159

sandrocsimas opened this issue Jun 21, 2014 · 12 comments
Labels

Comments

@sandrocsimas
Copy link

Hi, i'm getting "unexpected token S" on application startup

age.g (events.js:180:16)
[app-22 (err) 2014-06-21T12:57:21]     at IncomingMessage.emit (events.js:117:20)
[app-22 (err) 2014-06-21T12:57:21]     at _stream_readable.js:929:16
[app-22 (err) 2014-06-21T12:57:21]     at /opt/promessa-de-politico/node_modules/newrelic/node_modules/continuation-local-storage/node_modules/async-listener/glue.js:177:31
[app-22 (err) 2014-06-21T12:57:21]     at process._tickCallback (node.js:419:13)
[app-22 (err) 2014-06-21T12:57:21] New Relic for Node.js halted startup due to an error:
[app-22 (err) 2014-06-21T12:57:21] SyntaxError: Unexpected token S
[app-22 (err) 2014-06-21T12:57:21]     at Object.parse (native)
[app-22 (err) 2014-06-21T12:57:21]     at StreamSink.parser [as callback] (/opt/promessa-de-politico/node_modules/newrelic/lib/collector/parse-response.js:60:21)
[app-22 (err) 2014-06-21T12:57:21]     at StreamSink.end (/opt/promessa-de-politico/node_modules/newrelic/lib/util/stream-sink.js:41:8)
[app-22 (err) 2014-06-21T12:57:21]     at IncomingMessage.onend (_stream_readable.js:485:10)
[app-22 (err) 2014-06-21T12:57:21]     at IncomingMessage.g (events.js:180:16)
[app-22 (err) 2014-06-21T12:57:21]     at IncomingMessage.emit (events.js:117:20)
[app-22 (err) 2014-06-21T12:57:21]     at _stream_readable.js:929:16
[app-22 (err) 2014-06-21T12:57:21]     at /opt/promessa-de-politico/node_modules/newrelic/node_modules/continuation-local-storage/node_modules/async-listener/glue.js:177:31
[app-22 (err) 2014-06-21T12:57:21]     at process._tickCallback (node.js:419:13)

I'm using node v0.10.29 and express.

@txase
Copy link

txase commented Jun 23, 2014

@sandro-csimas We're sorry to hear that.

Are you able to confirm that this is still occurring? It's possible this was a momentary issue. Determining whether it is ongoing will help us diagnose the issue.

Thanks!

@sandrocsimas
Copy link
Author

Yes, is still occurring this error. These are the versions i use:
"newrelic": "1.7.3"
"express": "3.4.4"

@sandrocsimas
Copy link
Author

I will try to log some information and return with any detail

@sandrocsimas
Copy link
Author

OK, i put a console.log inside StreamSink.prototype.write = function write(string) on stream-sink.js file and its printing "WRITING STRING: Serialization Error"

When the function StreamSink.prototype.end = function end() is called, the callbackthis.callback(null, this.sink); is invoked (parse-response.js) and the error is throwed.

My application is hosted on DigitalOcean, maybe a issue with firewall or something like this.

@sandrocsimas
Copy link
Author

Checking bunyan logs i got:

[2014-06-24T05:30:51.276Z] DEBUG: newrelic/remote_method_invoke/9687 on simas: Finished receiving data back from the collector for connect.
[2014-06-24T05:30:51.276Z] DEBUG: newrelic/new_relic_response/9687 on simas: Got 415 as a response code from the collector.
[2014-06-24T05:30:51.277Z] DEBUG: newrelic/collector_api/9687 on simas: Failed attempting to connect to New Relic, waiting 120s to retry.

Can you check why the collector is responding 415 - Unsupported Media Type?

@txase txase added the bug label Jun 26, 2014
@sandrocsimas
Copy link
Author

Any answer please ?

@txase
Copy link

txase commented Jun 30, 2014

Hi @sandro-csimas,

We are still investigating this issue. This GitHub issue tracker is a best-effort support channel. We appreciate your patience as we work through issues!

You are also welcome to use the official New Relic support channels available at http://support.newrelic.com.

Thanks!

@wraithan
Copy link
Contributor

Howdy @sandro-csimas, I've never seen an error like this. If you can provide a way for me to reproduce it (a minimal application or environment) we can almost definitely help you. I know we have other customers running on DO without issue so I am hesitant to blame that platform.

If you go through support we can get your account information and look at your modules to see if there is anything that seems like it might cause problems. Also, it would give us the ability to ask for more logs. Isolated lines rarely tell enough of the story.

EDIT: 415 appears to mean malformed JSON was sent, to help with debugging this we are going to need detailed logs (which includes things you shouldn't share on github)

@sandrocsimas
Copy link
Author

Hi @wraithan, i solved the problem. I just change my newrelic.js from Promessa de Político to promessa-de-politico and the Newrelic starts to manage my nodejs application. Maybe a encoding issue, it is really weird what happened. Can you check this and close the issue ?
Thanks!!

@othiym23
Copy link
Contributor

To capture the discussion I had with @wraithan on IRC, I saw a few instances of this when I was working on node-newrelic. As @sandro-csimas intuited, the problem is the non-ISO-8859-1 characters in the application name, and the workaround is to remove them (@sandro-csimas, spaces are fine).

The problem, if I'm recalling it correctly, has something to do with how New Relic's servers deal with the encoding of the incoming JSON data, but there were some subtleties (it's nothing as simple as a missing encoding : "utf-8" somewhere. Also, if I'm recalling correctly, the Node agent's code is fine, which is too bad, because it would be a lot easier to fix on the agent end.

@txase
Copy link

txase commented Jun 30, 2014

@sandro-csimas @othiym23 @wraithan,

Thanks for tracking this issue down to a resolution! It looks like we've got a reasonable work-around and the issue isn't an actionable task for us to track down in the agent. I'm going to close this issue out.

@sandro-csimas, if you would like to follow up on support for better i18n support in our APM product beyond the Node.js Agent, I suggest reaching us through http://support.newrelic.com.

Thanks!

@txase txase closed this as completed Jun 30, 2014
@dommmel
Copy link

dommmel commented Jul 26, 2014

Got bitten by this as well today.
I think a hint in the readme/doc along the lines of "when choosing an app_name stick to ([A-Za-z0-9-_]+)" would have been helpful.

Anyway - thanks for the agent!

cmcadams-newrelic pushed a commit to cmcadams-newrelic/node-newrelic that referenced this issue Jan 29, 2024
…/code-level-metrics/express/follow-redirects-1.15.4

chore(deps): bump follow-redirects from 1.15.3 to 1.15.4 in /code-level-metrics/express
jsumners-nr pushed a commit to jsumners-nr/node-newrelic that referenced this issue Apr 16, 2024
…/word-wrap-1.2.4

Bump word-wrap from 1.2.3 to 1.2.4
bizob2828 added a commit to bizob2828/node-newrelic that referenced this issue Apr 19, 2024
updated versions tests to test v3 vesions > 3.194.0 as AWS seems to have fixed their issues
bizob2828 added a commit to bizob2828/node-newrelic that referenced this issue Apr 23, 2024
updated versions tests to test v3 vesions > 3.194.0 as AWS seems to have fixed their issues
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

5 participants