abhishekbhakat opened a new issue, #33871:
URL: https://github.com/apache/airflow/issues/33871

   ### Apache Airflow version
   
   2.7.0
   
   ### What happened
   
   ```
   Something bad has happened.
   
   Airflow is used by many users, and it is very likely that others had similar 
problems and you can easily find
   a solution to your problem.
   
   Consider following these steps:
   
     * gather the relevant information (detailed logs with errors, reproduction 
steps, details of your deployment)
   
     * find similar issues using:
        * <b><a href="https://github.com/apache/airflow/discussions";>GitHub 
Discussions</a></b>
        * <b><a href="https://github.com/apache/airflow/issues";>GitHub 
Issues</a></b>
        * <b><a href="https://stackoverflow.com/questions/tagged/airflow";>Stack 
Overflow</a></b>
        * the usual search engine you use on a daily basis
   
     * if you run Airflow on a Managed Service, consider opening an issue using 
the service support channels
   
     * if you tried and have difficulty with diagnosing and fixing the problem 
yourself, consider creating a <b><a 
href="https://github.com/apache/airflow/issues/new/choose";>bug report</a></b>.
       Make sure however, to include all relevant details and results of your 
investigation so far.
   
   Python version: 3.11.4
   Airflow version: 2.7.0.dev0
   Node: redact
   
-------------------------------------------------------------------------------
   Error! Please contact server admin.
   ```
   
   The traceback received is:
   
   ```
   [2023-08-29T08:26:46.947+0000] {app.py:1744} ERROR - Exception on 
/api/v1/variables/TEST_VAR [PATCH]
   Traceback (most recent call last):
     File 
"/Users/abhishekbhakat/Codes/Turbine/my_local_airflow/airflowenv/lib/python3.11/site-packages/flask/app.py",
 line 2529, in wsgi_app
       response = self.full_dispatch_request()
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File 
"/Users/abhishekbhakat/Codes/Turbine/my_local_airflow/airflowenv/lib/python3.11/site-packages/flask/app.py",
 line 1825, in full_dispatch_request
       rv = self.handle_user_exception(e)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File 
"/Users/abhishekbhakat/Codes/Turbine/my_local_airflow/airflowenv/lib/python3.11/site-packages/flask/app.py",
 line 1823, in full_dispatch_request
       rv = self.dispatch_request()
            ^^^^^^^^^^^^^^^^^^^^^^^
     File 
"/Users/abhishekbhakat/Codes/Turbine/my_local_airflow/airflowenv/lib/python3.11/site-packages/flask/app.py",
 line 1799, in dispatch_request
       return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File 
"/Users/abhishekbhakat/Codes/Turbine/my_local_airflow/airflowenv/lib/python3.11/site-packages/connexion/decorators/decorator.py",
 line 68, in wrapper
       response = function(request)
                  ^^^^^^^^^^^^^^^^^
     File 
"/Users/abhishekbhakat/Codes/Turbine/my_local_airflow/airflowenv/lib/python3.11/site-packages/connexion/decorators/uri_parsing.py",
 line 149, in wrapper
       response = function(request)
                  ^^^^^^^^^^^^^^^^^
     File 
"/Users/abhishekbhakat/Codes/Turbine/my_local_airflow/airflowenv/lib/python3.11/site-packages/connexion/decorators/validation.py",
 line 196, in wrapper
       response = function(request)
                  ^^^^^^^^^^^^^^^^^
     File 
"/Users/abhishekbhakat/Codes/Turbine/my_local_airflow/airflowenv/lib/python3.11/site-packages/connexion/decorators/validation.py",
 line 399, in wrapper
       return function(request)
              ^^^^^^^^^^^^^^^^^
     File 
"/Users/abhishekbhakat/Codes/Turbine/my_local_airflow/airflowenv/lib/python3.11/site-packages/connexion/decorators/response.py",
 line 112, in wrapper
       response = function(request)
                  ^^^^^^^^^^^^^^^^^
     File 
"/Users/abhishekbhakat/Codes/Turbine/my_local_airflow/airflowenv/lib/python3.11/site-packages/connexion/decorators/parameter.py",
 line 120, in wrapper
       return function(**kwargs)
              ^^^^^^^^^^^^^^^^^^
     File 
"/Users/abhishekbhakat/Codes/Turbine/my_local_airflow/airflowenv/lib/python3.11/site-packages/airflow/api_connexion/security.py",
 line 52, in decorated
       return func(*args, **kwargs)
              ^^^^^^^^^^^^^^^^^^^^^
     File 
"/Users/abhishekbhakat/Codes/Turbine/my_local_airflow/airflowenv/lib/python3.11/site-packages/airflow/utils/session.py",
 line 77, in wrapper
       return func(*args, session=session, **kwargs)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File 
"/Users/abhishekbhakat/Codes/Turbine/my_local_airflow/airflowenv/lib/python3.11/site-packages/airflow/www/decorators.py",
 line 127, in wrapper
       return f(*args, **kwargs)
              ^^^^^^^^^^^^^^^^^^
     File 
"/Users/abhishekbhakat/Codes/Turbine/my_local_airflow/airflowenv/lib/python3.11/site-packages/airflow/api_connexion/endpoints/variable_endpoint.py",
 line 118, in patch_variable
       setattr(variable, key, val)
   AttributeError: 'NoneType' object has no attribute 'key'
   127.0.0.1 - admin [29/Aug/2023:08:26:46 +0000] "PATCH 
/api/v1/variables/TEST_VAR HTTP/1.1" 500 1543 "-" "curl/8.1.2"
   ```
   
   ### What you think should happen instead
   
   The API call should have thrown a different HTTP Response. Say, 400 BAD 
REQUEST and Variable does not exist. 
   
   ### How to reproduce
   
   ```
   curl -vvvv -X PATCH "http://localhost:8888/api/v1/variables/TEST_VAR"; -H 
'Content-Type: application/json' -H "Authorization: Basic YWRtaW46YWRtaW4=" -d 
'{"key":"TEST_VAR","value":"TRUE"}'
   ```
   I used a basic auth with admin:admin as creds.
   
   
   ### Operating System
   
   macOS 13.5.1 22G90 arm64
   
   ### Versions of Apache Airflow Providers
   
   Not relevant
   
   ### Deployment
   
   Virtualenv installation
   
   ### Deployment details
   
   _No response_
   
   ### Anything else
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to