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

umami api client - switch to official client #59

Open
2 tasks
boly38 opened this issue Aug 30, 2024 · 2 comments
Open
2 tasks

umami api client - switch to official client #59

boly38 opened this issue Aug 30, 2024 · 2 comments
Labels
enhancement New feature or request industrialization

Comments

@boly38
Copy link
Owner

boly38 commented Aug 30, 2024

umami has now an official client : https://umami.is/docs/api/api-client

@boly38
Copy link
Owner Author

boly38 commented Aug 30, 2024

  • umami api client introduce an high severity issue
next  >=13.4.0 <14.1.1
Severity: high
Next.js Server-Side Request Forgery in Server Actions - https://github.com/advisories/GHSA-fr5h-rqp8-mj6g
fix available via `npm audit fix --force`
Will install @umami/api-client@0.41.0, which is a breaking change
node_modules/next
  next-basics  >=0.31.0
  Depends on vulnerable versions of next
  node_modules/next-basics
    @umami/api-client  >=0.42.0
    Depends on vulnerable versions of next-basics
    node_modules/@umami/api-client

with next dependency

$ npm list next
action-umami-report@ C:\WORK\perso\action-umami-report
└─┬ @umami/api-client@0.69.0
 └─┬ next-basics@0.36.0
   └── next@13.5.6

reported here

@boly38
Copy link
Owner Author

boly38 commented Aug 30, 2024

Trying very basic example is not working

  • server with umami docker self-hosted
  • umami version 2.13.3

env

export UMAMI_API_CLIENT_USER_ID=admin
export UMAMI_API_CLIENT_PASSWORD=xxx-replace-by-admin-password-here
export UMAMI_API_CLIENT_SECRET=xxx-replace-by-app-secret-set-in-docker-compose
export UMAMI_API_CLIENT_ENDPOINT=https://myumami.example.fr/api

node

import {getClient} from '@umami/api-client';

const umamiUsername = process.env.UMAMI_API_CLIENT_USER_ID;
const umamiPassword = process.env.UMAMI_API_CLIENT_PASSWORD;
let client;
const getMeFixed = false;
{
    client = getClient();
    const {ok, data, status, error} = await client.login(umamiUsername, umamiPassword);
    console.log(`login: ${JSON.stringify({ok, data, status, error}, null, 2)}`);
}
if (getMeFixed) {
    const {ok, data, status, error} = await client.getMe();
    console.log(`getMe: ${JSON.stringify({ok, data, status, error}, null, 2)}`);
}
{
    const {ok, data, status, error} = await client.getWebsites();
    console.log(`getWebsites: ${JSON.stringify({ok, data, status, error}, null, 2)}`);
}

result

login: {
  "ok": true,
  "data": {
    "token": "==REDATED==",
    "user": {
      "id": "==REDATED==",
      "username": "admin",
      "role": "admin",
      "createdAt": "2024-07-12T15:52:00.340Z",
      "isAdmin": true
    }
  },
  "status": 200
}
getWebsites: {
  "ok": false,
  "status": 504,
  "error": "<html>\r\n<head><title>504 Gateway Time-out</title></head>\r\n<body>\r\n<center><h1>504 Gateway Time-out</h1></center>\r\n<hr><center>nginx</center
>\r\n</body>\r\n</html>\r\n"
}

on docker side I got server error logs (was the same kind of error for getMe

PrismaClientKnownRequestError:
Invalid `prisma.user.findUnique()` invocation:


Inconsistent column data: Error creating UUID, invalid character: expected an optional prefix of `urn:uuid:` followed by [0-9a-fA-F-], found `m` at 3
    at _n.handleRequestError (/app/node_modules/@prisma/client/runtime/library.js:121:7749)
    at _n.handleAndLogRequestError (/app/node_modules/@prisma/client/runtime/library.js:121:7057)
    at _n.request (/app/node_modules/@prisma/client/runtime/library.js:121:6741)
    at async l (/app/node_modules/@prisma/client/runtime/library.js:130:9355)
    at async /app/.next/server/chunks/405.js:1:17597 {
  code: 'P2023',
  clientVersion: '5.17.0',
  meta: {
    modelName: 'User',
    message: 'Error creating UUID, invalid character: expected an optional prefix of `urn:uuid:` followed by [0-9a-fA-F-], found `m` at 3'
  }
}

this issue is close to umami-software/umami/issues/1964

this error is reported here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request industrialization
Projects
None yet
Development

No branches or pull requests

1 participant