bug: Create Org Role Endpoint, fails when organization Scope is not valid, but creates the organization #6891
Open
Description
Describe the bug
When creating a new Organization role with the Management API, if a not valid organization-scope is passed, the error 402 is returned (According to the docs this error only means that the org name is duplicated). But even if the error is being returned, the organization role is being created.
Expected behavior
I expect that if a non-valid organization-scope is given. It happens one of the following:
- The endpoint returns an error code, and the role is not creted
- The endpoint returns a 201, and the role is created only with the valid scopes
How to reproduce?
Context
- Logto Cloud
- Self-hosted, Logto version =
- Container (Docker image)
- Raw Node.js