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

SDK Doesn't work for Japan characters/letters in Target #121

Closed
daniel-johns-99 opened this issue Mar 26, 2024 · 3 comments · Fixed by #124
Closed

SDK Doesn't work for Japan characters/letters in Target #121

daniel-johns-99 opened this issue Mar 26, 2024 · 3 comments · Fixed by #124
Assignees

Comments

@daniel-johns-99
Copy link

daniel-johns-99 commented Mar 26, 2024

Whilst using the following for the target identifer:

  "target": {
    "identifier": "d5358360-87c5-4526-bc43-b0321107e494",
    "attributes": {
      "lastUpdated": "Tue Mar 26 2024 19:23:57 GMT+0900 (\u65e5\u672c\u6a19\u6e96\u6642)",
      "Version": "1225918127"
    }
 

We are getting the following error from the SDK

29.d9686e77.chunk.js:2 [FF-SDK] Authentication error:  DOMException: Failed to execute 'btoa' on 'Window': The string to be encoded contains characters outside of the Latin1 range.
    at /static/js/29.d9686e77.chunk.js:2:845943
    at Generator.next (<anonymous>)
    at /static/js/29.d9686e77.chunk.js:2:836966
    at new Promise (<anonymous>)
    at h (/static/js/29.d9686e77.chunk.js:2:836785)
    at static/js/29.d9686e77.chunk.js:2:845734

We are using the following suggested way from the lastUpdated step: Date()
https://github.com/harness/ff-javascript-client-sdk/blob/b4fea2301f7d03eb8ae438471470c8f892b04f86/README.md#no-streaming-or-polling

It seems this returns a non Latin and the UTF-8 characters rendered properly, it reads as "日本標準時" which translates to "Japan Standard Time".

@daniel-johns-99
Copy link
Author

Just going to add here: obviously I could solve this by using a different way to calculate the lastUpdated field and avoid non latin characters. The bigger problem is that the SDK breaks when being passed non latin characters. Other Harness SDK's don't have this same problem.

@davejohnston
Copy link
Contributor

@daniel-johns-99 I'll try and get an answer for why we aren't handling this correctly. One thing I'm curious about is do you rely on the lastUpdated target attribute for anything such as creating targeting rules?
I appreciate its in our examples, but if you don't explicitly require dynamic data like this, I'd recommend leaving it out, as it means you're less likely to benefit from CDN cached responses for a target, increasing evaluation response times.

@knagurski
Copy link
Contributor

@daniel-johns-99 Thanks for letting us know. I've just released v1.26.1 to address this. Please give it a try and let us know how it works out for you.

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