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

[Bug]: Proxy customer API endpoint triggers an internal error when attempting to update the max_budget value of a customer #6920

Open
mbertrand opened this issue Nov 26, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@mbertrand
Copy link

What happened?

Step 1.

Create a new customer with a max_budget:

curl --location 'http://0.0.0.0:4000/customer/new'         --header 'Authorization: Bearer sk-1234'         --header 'Content-Type: application/json'         --data '{
        "user_id" : "newuser01",
        "max_budget": 0.05,
        "tpm_limit": 1000,
        "rpm_limit": 5000,
        "budget_duration": "60m"       
    }'

The response is:

{
    "user_id": "newuser01",
    "alias": null,
    "spend": 0.0,
    "allowed_model_region": null,
    "default_model": null,
    "budget_id": "4e583dd9-dfcd-4762-995a-5ed2ece3311b",
    "litellm_budget_table": {
        "budget_id": "4e583dd9-dfcd-4762-995a-5ed2ece3311b",
        "max_budget": 0.05,
        "soft_budget": null,
        "max_parallel_requests": null,
        "tpm_limit": 1000,
        "rpm_limit": 5000,
        "model_max_budget": null,
        "budget_duration": "60m",
        "budget_reset_at": null,
        "created_at": "2024-11-26T14:42:11.109000Z",
        "created_by": "default_user_id",
        "updated_at": "2024-11-26T14:42:11.109000Z",
        "updated_by": "default_user_id",
        "organization": null,
        "keys": null,
        "end_users": null,
        "team_membership": null,
        "organization_membership": null
    },
    "blocked": false
}

Step 2.

Attempt to update the max_budget value of the customer:

curl --location 'http://0.0.0.0:4000/customer/update'         --header 'Authorization: Bearer sk-1234'         --header 'Content-Type: application/json'         --data '{
        "user_id" : "newuser01",
        "max_budget": 0.1,   
    }'

The response is:

{
    "error": {
        "message": "Internal Server Error, Could not find field at `updateOneLiteLLM_EndUserTable.data.max_budget`",
        "type": "internal_error",
        "param": "None",
        "code": "500"
    }
}

Relevant log output

litellm-1                    | 14:25:18 - LiteLLM Proxy:DEBUG: customer_endpoints.py:437 - /customer/update: Received data = user_id='[email protected]' alias=None blocked=False max_budget=0.05 budget_id=None allowed_model_region=None default_model=None                                                                                                                                                                                                                   
litellm-1                    | 14:25:18 - LiteLLM Proxy:DEBUG: customer_endpoints.py:440 - In update customer, user_id condition block.
litellm-1                    | 14:25:18 - LiteLLM Proxy:ERROR: customer_endpoints.py:457 - litellm.proxy.proxy_server.update_end_user(): Exception occured - Could not find field at `updateOneLiteLLM_EndUserTable.data.max_budget`    
litellm-1                    | INFO:     172.18.0.1:52846 - "POST /customer/update HTTP/1.1" 500 Internal Server Error                                                                                                                  
litellm-1                    | 14:25:18 - LiteLLM Proxy:DEBUG: customer_endpoints.py:462 - Traceback (most recent call last):                                                                                                           
litellm-1                    |   File "/usr/local/lib/python3.11/site-packages/litellm/proxy/management_endpoints/customer_endpoints.py", line 441, in update_end_user                                                                  
litellm-1                    |     response = await prisma_client.db.litellm_endusertable.update(                                                                                                                                       
litellm-1                    |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
litellm-1                    |   File "/usr/local/lib/python3.11/site-packages/prisma/actions.py", line 7846, in update                                                                                                                 
litellm-1                    |     resp = await self._client._execute(                                                                                                                                                                  
litellm-1                    |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                                                                                                  
litellm-1                    |   File "/usr/local/lib/python3.11/site-packages/prisma/client.py", line 528, in _execute                                                                                                                 
litellm-1                    |     return await self._engine.query(builder.build(), tx_id=self._tx_id)                                                                                                                                  
litellm-1                    |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                                                                  
litellm-1                    |   File "/usr/local/lib/python3.11/site-packages/prisma/engine/query.py", line 244, in query                                                                                                              
litellm-1                    |     return await self.request(                                                                                                                                                                           
litellm-1                    |            ^^^^^^^^^^^^^^^^^^^                                                                                                                                                                           
litellm-1                    |   File "/usr/local/lib/python3.11/site-packages/prisma/engine/http.py", line 141, in request
litellm-1                    |     return utils.handle_response_errors(resp, errors_data)                                                                                                                                               
litellm-1                    |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                                                                               
litellm-1                    |   File "/usr/local/lib/python3.11/site-packages/prisma/engine/utils.py", line 192, in handle_response_errors                                                                                             
litellm-1                    |     raise exc(error)                                                                                                                                                                                     
litellm-1                    | prisma.errors.FieldNotFoundError: Could not find field at `updateOneLiteLLM_EndUserTable.data.max_budget`                                                                                                
litellm-1                    |

Twitter / LinkedIn details

No response

@mbertrand mbertrand added the bug Something isn't working label Nov 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant