azure-sdk-for-js: firewallRules listByServer throws Invalid Array Length error.
- Package Name: @azure/arm-sql
- Package Version: 6.0.0 and 7.0.0
- Operating system: macOS Catalina 10.15.3
- nodejs
- version: 11.8.0
- browser
- name/version:
- typescript
- version: 3.7.4
- Is the bug related to documentation in
- README.md
- source code documentation
- SDK API docs on https://docs.microsoft.com
Describe the bug
Calling the firewallRules.listByServer()
method of the @azure/arm-sql
client causes an Invalid array length error
to be thrown.
I’ve traced the issue back to the flattenResponse()
method in msRest.node.js
in the node_modules package directory. The _response
object being passed into that function appears to have a property parsedBody
, but that property is an object, and is passed into the tslib.__spreadArrays()
function as if it were an array.
To Reproduce Steps to reproduce the behavior:
- Instantiate the sql management client with
import { SqlManagementClient } from "@azure/arm-sql";
const sqlManagementClient = new SqlManagementClient(credentials, subscriptionId)
- Call the firewallRules.listByServer function
const result = await sqlManagementClient.firewallRules.listByServer(resourcegroupName, serverName);
Expected behavior The function should return a list of firewall rules objects according to https://azuresdkdocs.blob.core.windows.net/$web/javascript/azure-arm-sql/6.0.0/classes/firewallrules.html#listbyserver
Screenshots
Additional context Add any other context about the problem here.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 23 (15 by maintainers)
After debugging for a while, it looks like the service is sending an XML body by default, and since the SWAGGER defines the response format as JSON our deserialization doesn’t know how to parse correctly.
@ebower12 as a workaround can you please try the following and let me know if it works?
The problem occurred when flattening json respons via msrest. Ask codegen team to take a look at it