getlago / lago-javascript-client

Lago Javascript Client
MIT License
21 stars 2 forks source link

[BUG]: customers endpoints "resource_not_found" #31

Closed carl-shen closed 1 year ago

carl-shen commented 1 year ago

Describe the bug Getting a Customer using this client library does not work, although making a direct request (using Insomnia or axios) to Lago to get the same Customer does work. Lago logs seem to suggest that the something related to path being unmatched?

Lago logs: lago-api | I, [2023-09-08T05:03:01.869264 #11] INFO -- : [17d85fb2-4a78-4747-95d8-59fd18859b1b] {"method":"GET","path":"/customers/EXAMPLEID01","format":"*/*","controller":"ApplicationController","action":"not_found","status":404,"duration":0.65,"view":0.2,"db":0.0,"ddsource":"ruby","params":{"unmatched":"customers/EXAMPLEID01"}}

The error response says "resource_not_found", which is the same as what I would get when sending a request to an invalid endpoint to my instance of Lago.

To Reproduce Steps to reproduce the behavior: Call this with this client: const response = await client.customers.findCustomer("EXAMPLEID01");

Expected behavior Response of the Customer object if Customer exists, or a "customer_not_found" response.

Support

P.S. Customer creation via this client also does not work, but direct requests work.

carl-shen commented 1 year ago

Hmm, seems to need the /api/v1 when setting up the custom baseUrl