Laravel 9 + Auth0 - adding permissions via the SDK and resource servers update() method

Hi everyone,

I am currently facing a weird issue where I am trying to add new permissions to my API in Auth0. Since the update() method in the resource servers endpoint via the SDK is by default a patch method I am having to first get all current permissions and do some merging / appending on my end. None the less when I only append one permission, the API works perfectly. But when I want to append more than one permission then I get the below error:

[22-Jul-2023 13:30:47 Australia/Sydney] {“statusCode”:400,“error”:“Bad Request”,“message”:“Payload validation error: ‘Expected type array but found type object’ on property scopes (List of permissions (scopes) that this API uses).”,“errorCode”:“invalid_body”}

What is really strange is yes, even though the original set of items (which I retrieve first, collect and map) are indeed a type of std class object and the new permission which I am appending is an array, as long as I only append one item then it will not get the above error. Only when I append multiple array items. I even updated the mapping function on my end to decode the std class objects into array items but still no joy.

Anyone that can help out would be much appreciated!