Closed genru closed 5 months ago
Hey,
I know it's crazy. this issue stuck me for a few days, I can duplicate it every time.
when I call
const products = await listProducts({ filter: { storeId: `${process.env.LEMONSQUEEZY_STORE_ID}` }, include: ['variants'] }) console.info(products.data?.data)
I will get
[ { type: 'products', id: '267440', attributes: { store_id: 87446, name: 'Pro Plan(test)', slug: 'pro-plantest', description: '<p>Pro test</p>', status: 'published', status_formatted: 'Published', // <---- here thumb_url: null, large_thumb_url: null, price: 1999, price_formatted: '$19.99 - $99.99', // <---- here from_price: 1999, to_price: 9999, pay_what_you_want: false, buy_now_url: 'https://auditio.lemonsqueezy.com/checkout/buy/156edaee-89d5-44bd-bb72-da5689856270', from_price_formatted: '$19.99', to_price_formatted: '$99.99', // <----- here created_at: '2024-05-11T13:24:02.000000Z', updated_at: '2024-06-07T13:49:18.000000Z', test_mode: true }, relationships: { store: [Object], variants: [Object] }, links: { self: 'https://api.lemonsqueezy.com/v1/products/267440' }
the product info is out of date, I am sure. actually I have unpublished this product already. and changed the variant price to 399.99
unpublished
399.99
the most ridiculous thing is the result returned by a direct http API call is correct.
https://api.lemonsqueezy.com/v1/products?filter[store_id]=87446&include=variants
get
{ "meta": { "page": { "currentPage": 1, "from": 1, "lastPage": 1, "perPage": 10, "to": 1, "total": 1 } }, "jsonapi": { "version": "1.0" }, "links": { "first": "https://api.lemonsqueezy.com/v1/products?filter%5Bstore_id%5D=87446&include=variants&page%5Bnumber%5D=1&page%5Bsize%5D=10&sort=name", "last": "https://api.lemonsqueezy.com/v1/products?filter%5Bstore_id%5D=87446&include=variants&page%5Bnumber%5D=1&page%5Bsize%5D=10&sort=name" }, "data": [ { "type": "products", "id": "267440", "attributes": { "store_id": 87446, "name": "Pro Plan(test 7)", "slug": "pro-plantest-7", "description": "<p>Pro test</p>", "status": "draft", // <---- correct "status_formatted": "Draft", // <---- correct "thumb_url": "https://lemonsqueezy.imgix.net/media/87446/88b0798b-f519-434b-8b9a-812845a29229.jpg?fit=clip&h=100&ixlib=php-3.3.1&w=100&s=b4f6945a6826135fde1655023e67b10f", "large_thumb_url": "https://lemonsqueezy.imgix.net/media/87446/88b0798b-f519-434b-8b9a-812845a29229.jpg?fit=clip&h=1000&ixlib=php-3.3.1&w=1000&s=b2cbe42fcaff368a5d4e000aacd1c29a", "price": 2999, "price_formatted": "$29.99 - $399.99", // <------ correct "from_price": 2999, "to_price": 39999, // <------ correct "pay_what_you_want": false, "buy_now_url": "https://auditio.lemonsqueezy.com/checkout/buy/156edaee-89d5-44bd-bb72-da5689856270", "from_price_formatted": "$29.99", "to_price_formatted": "$399.99", // <----- correct "created_at": "2024-05-11T13:24:02.000000Z", "updated_at": "2024-06-09T09:08:24.000000Z", "test_mode": true }, "relationships": { "store": { "links": { "related": "https://api.lemonsqueezy.com/v1/products/267440/store", "self": "https://api.lemonsqueezy.com/v1/products/267440/relationships/store" } }, "variants": { "links": { "related": "https://api.lemonsqueezy.com/v1/products/267440/variants", "self": "https://api.lemonsqueezy.com/v1/products/267440/relationships/variants" }, "data": [ { "type": "variants", "id": "374989" }, { "type": "variants", "id": "374900" }, { "type": "variants", "id": "374988" } ] } }, "links": { "self": "https://api.lemonsqueezy.com/v1/products/267440" } } ], "included": [ { "type": "variants", "id": "374989", "attributes": { "price": 1999, "is_subscription": true, "interval": "month", "interval_count": 1, "has_free_trial": false, "trial_interval": "day", "trial_interval_count": 30, "pay_what_you_want": false, "min_price": 0, "suggested_price": 0, "product_id": 267440, "name": "Default", "slug": "cd366e7c-f9dc-44de-9756-1797ea3f05a9", "description": "", "has_license_keys": false, "license_activation_limit": 5, "is_license_limit_unlimited": false, "license_length_value": 1, "license_length_unit": "years", "is_license_length_unlimited": false, "sort": 1, "status": "pending", "status_formatted": "Pending", "created_at": "2024-05-11T15:16:10.000000Z", "updated_at": "2024-05-11T15:16:10.000000Z", "test_mode": true }, "relationships": { "product": { "links": { "related": "https://api.lemonsqueezy.com/v1/variants/374989/product", "self": "https://api.lemonsqueezy.com/v1/variants/374989/relationships/product" } }, "files": { "links": { "related": "https://api.lemonsqueezy.com/v1/variants/374989/files", "self": "https://api.lemonsqueezy.com/v1/variants/374989/relationships/files" } }, "price-model": { "links": { "related": "https://api.lemonsqueezy.com/v1/variants/374989/price-model", "self": "https://api.lemonsqueezy.com/v1/variants/374989/relationships/price-model" } } }, "links": { "self": "https://api.lemonsqueezy.com/v1/variants/374989" } }, { "type": "variants", "id": "374900", "attributes": { "price": 2999, "is_subscription": true, "interval": "month", "interval_count": 1, "has_free_trial": false, "trial_interval": "day", "trial_interval_count": 30, "pay_what_you_want": false, "min_price": 0, "suggested_price": 0, "product_id": 267440, "name": "Monthly", "slug": "156edaee-89d5-44bd-bb72-da5689856270", "description": "<p>Subscription Monthly</p>", "has_license_keys": false, "license_activation_limit": 5, "is_license_limit_unlimited": false, "license_length_value": 1, "license_length_unit": "years", "is_license_length_unlimited": false, "sort": 2, "status": "published", "status_formatted": "Published", "created_at": "2024-05-11T13:24:03.000000Z", "updated_at": "2024-06-07T17:50:27.000000Z", "test_mode": true }, "relationships": { "product": { "links": { "related": "https://api.lemonsqueezy.com/v1/variants/374900/product", "self": "https://api.lemonsqueezy.com/v1/variants/374900/relationships/product" } }, "files": { "links": { "related": "https://api.lemonsqueezy.com/v1/variants/374900/files", "self": "https://api.lemonsqueezy.com/v1/variants/374900/relationships/files" } }, "price-model": { "links": { "related": "https://api.lemonsqueezy.com/v1/variants/374900/price-model", "self": "https://api.lemonsqueezy.com/v1/variants/374900/relationships/price-model" } } }, "links": { "self": "https://api.lemonsqueezy.com/v1/variants/374900" } }, { "type": "variants", "id": "374988", "attributes": { "price": 39999, "is_subscription": true, "interval": "year", "interval_count": 1, "has_free_trial": false, "trial_interval": "day", "trial_interval_count": 30, "pay_what_you_want": false, "min_price": 0, "suggested_price": 0, "product_id": 267440, "name": "Yearly", "slug": "f26e55f0-812b-43b2-ab8d-3a3a4fd5e37e", "description": "<p>Subscription yearly test</p>", "has_license_keys": false, "license_activation_limit": 5, "is_license_limit_unlimited": false, "license_length_value": 1, "license_length_unit": "years", "is_license_length_unlimited": false, "sort": 3, "status": "published", "status_formatted": "Published", "created_at": "2024-05-11T15:15:28.000000Z", "updated_at": "2024-06-07T17:36:59.000000Z", "test_mode": true }, "relationships": { "product": { "links": { "related": "https://api.lemonsqueezy.com/v1/variants/374988/product", "self": "https://api.lemonsqueezy.com/v1/variants/374988/relationships/product" } }, "files": { "links": { "related": "https://api.lemonsqueezy.com/v1/variants/374988/files", "self": "https://api.lemonsqueezy.com/v1/variants/374988/relationships/files" } }, "price-model": { "links": { "related": "https://api.lemonsqueezy.com/v1/variants/374988/price-model", "self": "https://api.lemonsqueezy.com/v1/variants/374988/relationships/price-model" } } }, "links": { "self": "https://api.lemonsqueezy.com/v1/variants/374988" } } ] }
it seems the SDK call returned a cached result.
tell me I am not a only person meet this issue.
the version info: "@lemonsqueezy/lemonsqueezy.js": "^3.0.0"
"@lemonsqueezy/lemonsqueezy.js": "^3.0.0"
sorry, it's a false report. I cleaned and rebuilt my nextjs project, it works correctly now. this issue closed
Hey,
I know it's crazy. this issue stuck me for a few days, I can duplicate it every time.
when I call
I will get
the product info is out of date, I am sure. actually I have
unpublished
this product already. and changed the variant price to399.99
the most ridiculous thing is the result returned by a direct http API call is correct.
get
it seems the SDK call returned a cached result.
tell me I am not a only person meet this issue.
the version info:
"@lemonsqueezy/lemonsqueezy.js": "^3.0.0"