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

Provide fallback store id in OrderSaveAfter observer #596

Merged
merged 1 commit into from
Dec 2, 2022

Conversation

chapagain
Copy link
Contributor

Fix 502 error on POST API Call

We upgraded dotdigital email module from v4.12.0 to v.4.19.3 on our Magento 2 store (Magento version 2.4.3-p2).

After the dotdigital module upgrade, the order post API call is not working. It's throwing 502 error.

curl --location --request POST 'https://mydomain.test/rest/V1/orders' \
--header 'Authorization: Bearer l5xxxxublxxxxxxxxxxigozdxxxxxjw' \
--header 'Content-Type: application/json' \
--data-raw '{
    "entity" : {
        "entity_id" : 11683,
        "increment_id" : "000011554",
        "status": "picked"
    }
}'

The $storeId was null on the REST API Call.

This PR fixes the issue.

@sta1r
Copy link
Contributor

sta1r commented Nov 24, 2022

@chapagain Thanks for this. Yes you're right, since 4.14.0 we made a change to always use the order's store id: 67c30b9#diff-7c6e256693f6d0a136df6d7a64ef525ccc08927e0cf4c74fdddf0e6cfc85fd40

A question about your suggested change though - if you're saving an order via API without specifying its store id, the default store id will be set against the order in our email_order table. Is this a concern? If you had different scopes, this could affect the sync fx by pushing an order into the wrong Dotdigital account.

@sta1r
Copy link
Contributor

sta1r commented Nov 29, 2022

@chapagain we're preparing to merge this. Please could you change the title to 'Provide fallback store id in OrderSaveAfter observer'?

@sta1r sta1r self-requested a review November 29, 2022 10:09
@sta1r sta1r changed the title Fix 502 error on POST API Call Provide fallback store id in OrderSaveAfter observer Nov 30, 2022
@sta1r sta1r merged commit 5469e3f into dotmailer:develop Dec 2, 2022
simon-letch pushed a commit that referenced this pull request Dec 6, 2022
This change provides a fallback store id (the default store id for the Magento instance) in case one isn't present in the event payload.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants