-
Notifications
You must be signed in to change notification settings - Fork 10
Open
Description
Hi
Context:
using umami client targetting an umami cloud website instance :
- I m using my gist (rev 6) as base example
https://gist.github.com/boly38/081318e620b6625467fef75bcb91b618#file-umaminodesample-js
I'm trying to retrieve node client response as json.
and here is what I get
I changed the end of the script to show response
const response = await umamiClient.track(event);
console.log(`✮ Event ${JSON.stringify(event)}`);
// 1st test
// const json = await response.json();
// console.log(`Event response JSON : ${json}`);
// second test
// const text = await response.text();
// const base64ToString = Buffer.from(text, "base64").toString();
// console.log(`Event response base64ToString : ${base64ToString}`);
1st example console result is
✮ Event {"url":"/home","title":"title of /home","name":"button-click","data":{"color":"red"}}
undefined:1
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.e------------REDACTED--------DZ7fFPYaLhXYo1iVf7mC41Cbk74-wGzQ
SRGQzxfq4
^
SyntaxError: Unexpected token 'e', "eyJhbGciOi"... is not valid JSON
at JSON.parse (<anonymous>)
at parseJSONFromBytes (node:internal/deps/undici/undici:4306:19)
at successSteps (node:internal/deps/undici/undici:4288:27)
at fullyReadBody (node:internal/deps/undici/undici:2724:9)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async consumeBody (node:internal/deps/undici/undici:4297:7)
Second example console result is
✮ Event {"url":"/home","title":"title of /home","name":"button-click","data":{"color":"red"}}
Event response base64ToString : {"alg":"HS256","typ":"JWT"}{"id":"2e5bdff5---REDACTED--ce98dec9eb59","websiteId":"b1eb5f43--REDACTED--44549dddd65e","visitId":"9c53435d--REDACTED--05c660a
7c840","browser":null,"os":null,"country":"FR","subdivision1":"FR-IDF","city":"Paris","iat":1730924085}☼↔��Y��Z�wloF��G�q<{)|l
�q1�1f{�
I just redacted some part of the id.
Is this a client or backend (cloud) issue ?
I suspect backend because I even tried to use a patched version of the client adding "Accept: application/json to the request but I got the same issue.
It's a kind of base64 of the (json + other data)...
Any hint appreciated.
regards
Metadata
Metadata
Assignees
Labels
No labels