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

"allow_profiles_outside_organization is required" error when parsing Organization object #368

Open
FilipAtScribe opened this issue Sep 27, 2024 · 7 comments

Comments

@FilipAtScribe
Copy link

FilipAtScribe commented Sep 27, 2024

When sending an organization.created event (both a test event and a real one) an error is thrown:
allow_profiles_outside_organization is required.

The field is marked as deprecated since version 4.12.0

@mattgd
Copy link
Contributor

mattgd commented Sep 27, 2024

Hi @FilipAtScribe, thanks for your report. Could you confirm which version of the Python SDK you're using? Could you also clarify if you're experiencing this issue when receiving an organization.created webhook event, or when querying the events API?

@FilipAtScribe
Copy link
Author

FilipAtScribe commented Sep 27, 2024

Hi @mattgd
The version we're using is 5.4.1
and the issue arises when receiving a organization.created event
i'm assuming the same happens on organization.deleted and organization.updated as we use
from workos.types.organizations import Organization for parsing the response.
Here is the class in the 5.4.1 version:

class Organization(OrganizationCommon):
    allow_profiles_outside_organization: bool
    domains: Sequence[OrganizationDomain]
    lookup_key: Optional[str] = None

@mattgd
Copy link
Contributor

mattgd commented Sep 27, 2024

Thanks for those details. The Organization object returned via events is slightly leaner than what is returned via the organization APIs. If you're doing some separate type validation on your end, the type you're looking for when using events is from workos.types.organizations import OrganizationCommon. Could you take a look and see if you have any success with that?

Our goal is to keep event objects and API objects as unified as possible, but there is some drift between a handful of them.

@mirzadelic
Copy link

Same issue here.

@mattgd will this be updated in any future version so this parameter is optional in class? Either that or to update documentation to not show Organization object to use for webhooks.

@mattgd
Copy link
Contributor

mattgd commented Sep 30, 2024

Hi @mirzadelic, thanks for your report. Do you have some example code for how you're handling the organization.created webhook event? I want to make sure we're testing this properly, and also are able to correctly update the docs to make this more clear.

The allow_profiles_outside_organization property is deprecated in the API and will eventually be entirely removed, but we'll see what adjustments need to be made in the meantime to clear this up.

@mirzadelic
Copy link

mirzadelic commented Sep 30, 2024

@mattgd using it as Organization(**data) where data is dict of values without allow_profiles_outside_organization. But if you check here: https://github.com/workos/workos-python/blob/main/workos/types/organizations/organization.py#L7 there is allow_profiles_outside_organization: bool, should be optional.

But I understand we can use OrganizationCommon in this case.

@mattgd
Copy link
Contributor

mattgd commented Sep 30, 2024

Got it, thanks. The intended usage is to use the return data as-is, which is an OrganizationCommon object (from workos.types.organizations import OrganizationCommon). I can see how this is confusing from the API reference docs, which we can clarify.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants