Shopware 6订单状态转换引发500状态代码错误。

huangapple go评论56阅读模式
英文:

Shopware6 order state transition throws 500 status code error

问题

我们在Shopware6 DemoStore上的API中遇到了技术问题,该API执行订单状态转换。每当我们调用订单状态转换API时,第一次尝试会收到500错误,第二次尝试会得到200。即使我们在响应中收到500状态代码,我们也在管理面板上看到订单状态已更新。我们尝试了不同的集成,甚至使用了管理员权限,但仍然遇到了相同的错误。

这里是一个示例请求:

第一次尝试(500错误,但订单状态仍然得到更新):

POST /api/_action/order/1fa508dcfbcf4fa2ae17a880708d5c4b/state/process

{
    "errors": [
        {
            "code": "0",
            "status": "500",
            "title": "Internal Server Error",
            "detail": "Could not find order context with referenced_order_id \"1fa508dcfbcf4fa2ae17a880708d5c4b\"."
        }
    ]
}

第二次尝试(200正常):

POST /api/_action/order/1fa508dcfbcf4fa2ae17a880708d5c4b/state/process

{
    "name": "In Bearbeitung",
    "technicalName": "in_progress",
    "stateMachineId": "829e4b7329d648e3af48c87bf3838b9b",
    "stateMachine": null,
    "fromStateMachineTransitions": null,
    "toStateMachineTransitions": null,
    "translations": null,
    "orders": null,
    "orderTransactionCaptures": null,
    "orderTransactionCaptureRefunds": null,
    "orderTransactions": null,
    "orderDeliveries": null,
    "fromStateMachineHistoryEntries": null,
    "toStateMachineHistoryEntries": null,
    "_uniqueIdentifier": "aa16871f5106458c82cc72c5aba45873",
    "versionId": null,
    "translated": {
        "name": "In Bearbeitung",
        "customFields": []
    },
    "createdAt": "2022-04-15T10:14:05.167+00:00",
    "updatedAt": null,
    "extensions": {
        "foreignKeys": {
            "apiAlias": null,
            "extensions": []
        }
    },
    "id": "aa16871f5106458c82cc72c5aba45873",
    "customFields": null
}

几天前我们没有遇到这个问题。这可能是由于DemoStore最近发布的更新导致的吗?当前版本是6.4.15.0。

英文:

we have a technical issue with the API that performs the order state transition on our Shopware6 DemoStore.

Whenever we call the order state transition API, on the first attempt we get a 500 error, on the second we get 200.
Even if we get 500 status code in the response, we see on the admin panel that the order status gets updated.
We tried different integrations, even with Admin permissions, but we still get the same error.

I'll leave here an example request:

First attempt (500 error, but order status still gets updated):

POST /api/_action/order/1fa508dcfbcf4fa2ae17a880708d5c4b/state/process

{
    "errors": [
        {
            "code": "0",
            "status": "500",
            "title": "Internal Server Error",
            "detail": "Could not find order context with referenced_order_id \"1fa508dcfbcf4fa2ae17a880708d5c4b\"."
        }
    ]
}

Second attempt (200 ok):

POST /api/_action/order/1fa508dcfbcf4fa2ae17a880708d5c4b/state/process

{
    "name": "In Bearbeitung",
    "technicalName": "in_progress",
    "stateMachineId": "829e4b7329d648e3af48c87bf3838b9b",
    "stateMachine": null,
    "fromStateMachineTransitions": null,
    "toStateMachineTransitions": null,
    "translations": null,
    "orders": null,
    "orderTransactionCaptures": null,
    "orderTransactionCaptureRefunds": null,
    "orderTransactions": null,
    "orderDeliveries": null,
    "fromStateMachineHistoryEntries": null,
    "toStateMachineHistoryEntries": null,
    "_uniqueIdentifier": "aa16871f5106458c82cc72c5aba45873",
    "versionId": null,
    "translated": {
        "name": "In Bearbeitung",
        "customFields": []
    },
    "createdAt": "2022-04-15T10:14:05.167+00:00",
    "updatedAt": null,
    "extensions": {
        "foreignKeys": {
            "apiAlias": null,
            "extensions": []
        }
    },
    "id": "aa16871f5106458c82cc72c5aba45873",
    "customFields": null
}

Some days ago we didn't have this problem. Could it be dued to some update that has been released recently on the DemoStore? Actual version is 6.4.15.0.

答案1

得分: 1

我禁用了 "B2B-Suite for Shopware" 扩展,现在 API 在第一次调用时总是返回 200。
根据Timo Helmke的建议,问题来自于这里:

Shopware\B2B\Order\Framework\OrderContextRepository::fetchOneOrderContextByReferencedOrderId

实际扩展版本为4.6.5。

英文:

I disabled the "B2B-Suite for Shopware" extension and now the API always answers 200 at the first call.
As suggested by Timo Helmke the problem is coming from this:

Shopware\B2B\Order\Framework\OrderContextRepository::fetchOneOrderContextByReferencedOrderId

The actual extension version is 4.6.5.

huangapple
  • 本文由 发表于 2023年3月9日 19:28:59
  • 转载请务必保留本文链接:https://go.coder-hub.com/75683986.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定