Hi there,
It's been a while since we last reached out. I hope you're all doing well.
I'm writing to you today because we've encountered an issue with inserting new products in Medusa, and I could use some assistance in resolving it.
When attempting to create a new product, even with the most basic data, we've noticed that Medusa is not correctly handling the money amount. I want to clarify that I may be missing something obvious, but here's a simplified version of how we're trying to create a product:
await this.productService_.create(
{
...productPayload, variants: [
{
title: "Default",
sku: product.SUPPLIER_PID._text,
prices: [{ amount: 1, currency_code: "eur" }],
inventory_quantity: 100,
},
]
}
);
However, it seems that the insert query is not capturing the money amount correctly. Here's the relevant error message we're encountering:
{
"query": "INSERT INTO \"public\".\"product_variant_money_amount\"(\"variant_id\", \"money_amount_id\") VALUES ($1, DEFAULT)",
"parameters": [
"variant_01HC2VRNTCZTASV9EPJ0BM3NCW"
],
"driverError": {
"length": 342,
"name": "error",
"severity": "ERROR",
"code": "23502",
"detail": "Failing row contains (null, null, variant_01HC2VRNTCZTASV9EPJ0BM3NCW, null, 2023-10-06 16:05:10.897964+00, 2023-10-06 16:05:10.897964+00).",
"schema": "public",
"table": "product_variant_money_amount",
"column": "id",
"file": "execMain.c",
"line": "1883",
"routine": "ExecConstraints"
},
"length": 342,
"severity": "ERROR",
"code": "23502",
"detail": "Failing row contains (null, null, variant_01HC2VRNTCZTASV9EPJ0BM3NCW, null, 2023-10-06 16:05:10.897964+00, 2023-10-06 16:05:10.897964+00).",
"schema": "public",
"table": "product_variant_money_amount",
"column": "id",
"file": "execMain.c",
"line": "1883",
"routine": "ExecConstraints"
}
From what I understand, it appears that Medusa is trying to create a new relation with a default value for the money amount, when it should be set to 1 in this particular case.
Thank you very much for your help! ❤️
Medusa v1.17.0
Node v20.5.1