Skip to content

Conversation

@yashwantbezawada
Copy link

Fixes #6101

Description

Fixed TypeError in PrivateEndpoint.raw_predict() caused by incorrect parameter name when calling AuthorizedSession.post().

Problem

When calling PrivateEndpoint.raw_predict() with PSC (Private Service Connect) based endpoints, the method crashed with:

TypeError: Session.request() got an unexpected keyword argument 'body'

Root Cause

The google-auth-transport library updated its API, changing the parameter name from body to data for AuthorizedSession.post().

The Endpoint.raw_predict() method was updated to use data, but PrivateEndpoint.raw_predict() was missed and still used body.

Changes

File: google/cloud/aiplatform/models.py
Line: 4153

Changed:

return self._authorized_session.post(
    url=url,
    body=body,  # ← incorrect parameter name
    headers=headers,
)

To:

return self._authorized_session.post(
    url=url,
    data=body,  # ← correct parameter name
    headers=headers,
)

Testing

This fix aligns PrivateEndpoint.raw_predict() with the already-corrected Endpoint.raw_predict() implementation (line 2744), which uses data=body.

The issue reporter confirmed the fix resolves the crash when calling raw_predict() on PSC-based PrivateEndpoint instances.

@product-auto-label product-auto-label bot added size: xs Pull request size is extra small. api: vertex-ai Issues related to the googleapis/python-aiplatform API. labels Nov 10, 2025
Fixes googleapis#6101

Changed parameter name from 'body' to 'data' in PrivateEndpoint.raw_predict
to match google-auth-transport's AuthorizedSession.post() API signature.

The google-auth-transport library updated its API, changing the parameter
name from 'body' to 'data'. The Endpoint class was already updated to use
'data', but PrivateEndpoint class was missed, causing TypeError when calling
raw_predict() on PrivateEndpoint instances.

This fix aligns PrivateEndpoint.raw_predict() with Endpoint.raw_predict()
implementation.

Signed-off-by: Yashwant Bezawada <yashwant_b@me.com>
@yashwantbezawada yashwantbezawada force-pushed the fix/private-endpoint-raw-predict-parameter branch from b689573 to 2681770 Compare November 10, 2025 08:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: vertex-ai Issues related to the googleapis/python-aiplatform API. size: xs Pull request size is extra small.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

aiplatform.PrivateEndpoint.raw_predict crash (TypeError: Session.request() got an unexpected keyword argument 'body')

1 participant