-
Notifications
You must be signed in to change notification settings - Fork 38
Description
After upgrading to 4.0.0 I found that users.get_billing_subscription() was not returning the user's subscription plan under subscription_items. Upon looking at the documentation and the code I think that this is a bug.
Here's a small example that reproduces the issue:
clerk = Clerk(CLERK_SECRET_KEY)
user_id = 'XXXXXXXXXXXXXXXXXXXXXXX'
subscription = clerk.users.get_billing_subscription(user_id=user_id)
print(subscription.subscription_items[0].plan) # Prints nothing
print(type(subscription.subscription_items[0].plan)) # Returns `<class 'clerk_backend_api.types.basemodel.Unset'>`Please note that you need to call this with a user that has subscribed to a plan.
I'm not really familiar with Pydantic but I think this is caused by the FeatureResponse model being too restrictive. It expects the avatar_url field to be a string but in my project none of the features have avatars, and so their value is null. I fixed this by changing the type definition to Optional[str] here.
I think this needs to be fixed at the documentation level since the docs clearly show that avatar_url is required as a string.
Thanks for looking into this.