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

g11n-pipeline.uploadStrings error with specific characters #34

Closed
Setogit opened this issue Jul 24, 2016 · 5 comments
Closed

g11n-pipeline.uploadStrings error with specific characters #34

Setogit opened this issue Jul 24, 2016 · 5 comments
Assignees
Labels
Milestone

Comments

@Setogit
Copy link

Setogit commented Jul 24, 2016

g11n-pipeline v1.2.2 and GA Globalization Pipeline on Bluemix service.

The attached JSON strings cases uploadStrings to fail with the following error:
uploadStrings error: {"obj":{"status":"ERROR","message":"Failed to authenticate user: [my credential]

{
  "msgBoxDrawingChars": "└──"
}

boxDrawingChars.txt

@yumaoka
Copy link

yumaoka commented Jul 26, 2016

The JSON contents above successfully uploaded on Bluemix dashboard. So this is not REST API server issue. The error message is "Failed to authenticate..", so there is something wrong with authentication. Can you also check if it works well with a different value with the same instance/bundle/user/pass?

@srl295
Copy link
Contributor

srl295 commented Jul 26, 2016

I wasn't able to reproduce with the above file (renamed to boxDrawingChars.json).

> var bdc = require('/Users/srl/Downloads/boxDrawingChars.json');
> bdc
{ msgBoxDrawingChars: '└──' }
> b.uploadStrings({languageId: 'en', strings: bdc}, console.log);
null { status: 'SUCCESS' }
> b.getResourceStrings({languageId: 'en'}, console.log);
null { status: 'SUCCESS',
  resourceStrings: { msgBoxDrawingChars: '└──' },
  updatedAt: '2016-07-26T20:45:23.807Z' }

@yumaoka
Copy link

yumaoka commented Aug 9, 2016

GP authentication is date sensitive. When a client system's clock is different from REST server more than 10 minutes, then the generated authentication code is invalidated. Can you check the client system's clock is accurate?

@srl295
Copy link
Contributor

srl295 commented Aug 9, 2016

The bug is in fact due to nodejs/node#5499 (comment) — apparently update() takes an encoding param.

@srl295 srl295 self-assigned this Aug 9, 2016
@srl295 srl295 added the bug label Aug 9, 2016
@srl295 srl295 added this to the v1.2.3 milestone Aug 9, 2016
srl295 added a commit to srl295/gp-js-client that referenced this issue Aug 9, 2016
* Thanks to nodejs/node#5499 (comment) … it seems that crypto.….update() needs to take an encoding parameter.
* Add a test case for non-utf8 text in upload

Fixes: IBM-Cloud#34
srl295 added a commit to srl295/gp-js-client that referenced this issue Aug 9, 2016
@srl295 srl295 mentioned this issue Aug 9, 2016
@srl295
Copy link
Contributor

srl295 commented Aug 9, 2016

so according to https://nodejs.org/api/crypto.html#crypto_hmac_update_data_input_encoding the default is utf-8 , but this wasn't true in previous node versions.

In particular, v4.x and v0.12.x did not default to utf8.

@srl295 srl295 closed this as completed in #41 Aug 9, 2016
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