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

🚨🐛 Source Shopify: Retry requests that return HTTP 500 #50976

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

keiththompson
Copy link
Contributor

@keiththompson keiththompson commented Jan 8, 2025

What

I've observed the orders stream getting a HTTP 500 and marking the stream as complete. I would have expected this to either retry or fail. Please let me know if this was a conscious design choice. In my mind, a sync succeeding should mean all of the data is fully in place.

From looking at the implementation, it looks as though there is an expectation of some retries, but with the ShopifyNonRetryableErrors class configured as it is, none of these will happen on HTTP 500.

In my case running the sync again did fill in the gaps, which means the issue was transient and therefore, retryable.

Logs

{
    "type": "STATE",
    "state": {
        "type": "STREAM",
        "stream": {
            "stream_descriptor": {
                "name": "orders"
            },
            "stream_state": {
                "updated_at": "2024-11-18T17:06:34-05:00",
                "deleted": {
                    "deleted_at": ""
                }
            }
        },
        "sourceStats": {
            "recordCount": 250
        }
    }
}
{
    "type": "LOG",
    "log": {
        "level": "INFO",
        "message": "Stream `orders`. Entity might not be available or missing."
    }
}
{
    "type": "STATE",
    "state": {
        "type": "STREAM",
        "stream": {
            "stream_descriptor": {
                "name": "orders"
            },
            "stream_state": {
                "updated_at": "2024-11-18T17:06:34-05:00",
                "deleted": {
                    "deleted_at": ""
                }
            }
        },
        "sourceStats": {
            "recordCount": 0
        }
    }
}
{
    "type": "LOG",
    "log": {
        "level": "INFO",
        "message": "Read xxx records from orders stream"
    }
}
{
    "type": "LOG",
    "log": {
        "level": "INFO",
        "message": "Marking stream orders as STOPPED"
    }
}
{
    "type": "TRACE",
    "trace": {
        "type": "STREAM_STATUS",
        "emitted_at": 1736229749445.883,
        "stream_status": {
            "stream_descriptor": {
                "name": "orders"
            },
            "status": "COMPLETE"
        }
    }
}
{
    "type": "LOG",
    "log": {
        "level": "INFO",
        "message": "Finished syncing orders"
    }
}

How

Removed HTTP 500 from the list of non retryable errors.

Review guide

  1. airbyte-integrations/connectors/source-shopify/source_shopify/utils.py
  2. airbyte-integrations/connectors/source-shopify/source_shopify/streams/base_streams.py (get_error_handler func)

User Impact

HTTP 500 will Retry rather than be ignored.

Can this PR be safely reverted and rolled back?

  • YES 💚
  • NO ❌

Copy link

vercel bot commented Jan 8, 2025

@keiththompson is attempting to deploy a commit to the Airbyte Growth Team on Vercel.

A member of the Team first needs to authorize it.

@octavia-squidington-iii octavia-squidington-iii added the area/connectors Connector related issues label Jan 8, 2025
@keiththompson keiththompson force-pushed the keiththompson/shopify_retry_http_500 branch from 5482b14 to 282b658 Compare January 8, 2025 12:57
@keiththompson keiththompson force-pushed the keiththompson/shopify_retry_http_500 branch from 282b658 to af12b19 Compare January 8, 2025 13:01
@octavia-squidington-iii octavia-squidington-iii added the area/documentation Improvements or additions to documentation label Jan 8, 2025
@keiththompson keiththompson force-pushed the keiththompson/shopify_retry_http_500 branch from c9ae9ab to c86509e Compare January 8, 2025 13:15
@marcosmarxm marcosmarxm requested a review from artem1205 January 9, 2025 20:45
@marcosmarxm
Copy link
Member

Hello @keiththompson, I asked the team to review your contribution. Since it involves changes to a widely used connector, it may take some time to ensure that the change is the best option. If you need any updates on the status of your contribution, feel free to message me on Slack.

Copy link
Collaborator

@bazarnov bazarnov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine with the change, but we've seen unpredictable api behavior in the past, for some entities were not available alongside the HTTP-500 (which is apparently incorrectly provided error status code, because the HTTP-404 was expected).

This is hard to predict what would it be for the rest of the Customers, but i'm pretty sure by far, this collisions might have been already resolved by Shopify.

Let's merge it.

@bazarnov
Copy link
Collaborator

@marcosmarxm I believe we need the approval here to run the required CI checks. Could you please take a look?

Copy link

vercel bot commented Jan 15, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
airbyte-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 15, 2025 11:26am

@marcosmarxm
Copy link
Member

Running tests @keiththompson and @bazarnov let's wait.

@maxi297
Copy link
Contributor

maxi297 commented Jan 17, 2025

It seems like there is a unit test failure related to this change. Can we fix that?

@keiththompson
Copy link
Contributor Author

It seems like there is a unit test failure related to this change. Can we fix that?

I think these are passing now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/connectors Connector related issues area/documentation Improvements or additions to documentation community connectors/source/shopify
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants