apache / airflow

Apache Airflow - A platform to programmatically author, schedule, and monitor workflows
https://airflow.apache.org/
Apache License 2.0
36.79k stars 14.23k forks source link

Google Display & Video 360 operators fail on POST requests #10076

Closed echom closed 1 year ago

echom commented 4 years ago

Apache Airflow version: airflow-1.10.6

Kubernetes version (if you are using kubernetes) (use kubectl version): 1.18.6

Environment: Google Cloud Composer v1.10.0

What happened:

airflow.providers.google.marketing_platform.operators.display_video.GoogleDisplayVideo360RunReportOperator as well as airflow.providers.google.marketing_platform.operators.display_video.GoogleDisplayVideo360CreateReportOperator fail to complete when setting the api_version parameter to the current version v1.1 instead of the default (and now deprecated) v1. In both cases the POST request return a redirect HTTP code (303) without a Location header. Full error message log (note that httplib2 debug output is enabled): log.txt

What you expected to happen: Both operators should execute successfully.

What do you think went wrong?: I believe that there different interpretations of the HTTP 303 code between the DV360 API and httplib2. Httplib2 tries to follow the 303 redirect but fails due to the missing location header. I believe the implementation of httplib2 is correct, however, the DV360 operators need to handle the arguably invalid response and interpret it as a successful operation with no result. I was able to work around it by temporarily disabling follow_redirectson the service object inside the GoogleDisplayVideo360Hook while the POST requests where executed.

How to reproduce it: Run either of the operators, e.g.:

run = GoogleDisplayVideo360RunReportOperator(
      task_id="test_run",
      dag=dag,
      api_version="v1.1",
      report_id=report_id)

Anything else we need to know:

How often does this problem occur? Once? Every time etc?: Every time

boring-cyborg[bot] commented 4 years ago

Thanks for opening your first issue here! Be sure to follow the issue template!

turbaszek commented 4 years ago

Thanks @echom for the issue! I will take a look at it :)

echom commented 4 years ago

Apologies, I posted the wrong log file from an old Orchestra implementation. Just updated to the correct log file, the error is the same.

turbaszek commented 4 years ago

@echom if you know how to fix the issue would you like to do this?

turbaszek commented 4 years ago

Hm, interesting because I run this operator from out example DAG:

    create_report = GoogleDisplayVideo360CreateReportOperator(
        body=REPORT, task_id="create_report", api_version="v1.1"
    )

and it seems to be working

turbaszek commented 4 years ago

Which version of google libraries do you use?

google-api-core==1.21.0
google-api-python-client==1.9.3
echom commented 4 years ago

I am running on Google Cloud Composer 1.10.6. According to their versioning:

google-api-core==1.16.0 google-api-python-client==1.7.8

Let me try to explicitly install your versions.

turbaszek commented 4 years ago

I think we were similar issue but I cannot find it. @mik-laj do you remember something more? https://github.com/apache/airflow/pull/9194

echom commented 4 years ago

Ok, after a bit of a struggle with version issues I now arrived at the following:

httplib2==0.18 apache-airflow-backport-providers-google==2020.6.24 google-api-core==1.21.0 google-api-python-client==1.9.3 google-auth=1.20.0 grpcio=1.30.0

Still the issue persists.

@turbaszek Can you do me a favor and check if the API responds with a 303 for you? You should be able to get the response logged when httplib2.debuglevel = 1

I have a line in my log that looks like this:

{logging_mixin.py:112} INFO - reply: 'HTTP/1.1 303 See Other\r\n'

turbaszek commented 4 years ago

No 303 on my side. However, this seems to be related: https://github.com/apache/airflow/issues/8810

rafalbiegacz commented 1 year ago

#8810 is closed.

Should this item be closed as "no repro"?

eladkal commented 1 year ago

Closing as can't reproduce. If issue still relevant please open a new issue.