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

After upgrading: type error when POSTing body using a generated TS client #1464

Open
IkeOTL opened this issue Oct 31, 2024 · 1 comment
Open
Assignees
Labels
bug Something isn't working type:bug A broken experience

Comments

@IkeOTL
Copy link

IkeOTL commented Oct 31, 2024

I upgraded from

"@microsoft/kiota-abstractions": "^1.0.0-preview.57",
"@microsoft/kiota-http-fetchlibrary": "^1.0.0-preview.56",
"@microsoft/kiota-serialization-form": "^1.0.0-preview.46",
"@microsoft/kiota-serialization-json": "^1.0.0-preview.57",
"@microsoft/kiota-serialization-multipart": "^1.0.0-preview.35",
"@microsoft/kiota-serialization-text": "^1.0.0-preview.54",

to
"@microsoft/kiota-bundle": "^1.0.0-preview.72"

And now I get this error when calling a POST function on a TS client generated using dotnet tool microsoft.openapi.kiota = 1.19.1
error:

TypeError: The "chunk" argument must be one of type string or Buffer. Received type object
    at validChunk (index.js:1:23577)
    at Writable.write (index.js:1:23989)
    at Writable.end (index.js:1:27532)
    at zlibBuffer (index.js:1:8869)
    at t.gzip (index.js:1:7829)
    at eval (compressionHandler.js:164:1)
    at new Promise (<anonymous>)
    at CompressionHandler.compressUsingZlib (compressionHandler.js:163:1)
    at async CompressionHandler.compressRequestBody (compressionHandler.js:153:1)
    at async CompressionHandler.executeInternal (compressionHandler.js:60:1)
    at async UserAgentHandler.addValue (userAgentHandler.js:53:1)
    at async RedirectHandler.executeWithRedirect (redirectHandler.js:105:1)
    at async RetryHandler.executeWithRetry (retryHandler.js:123:1)
    at async HttpClient.executeFetch (httpClient.js:53:1)
    at async eval (fetchRequestAdapter.js:481:1)
    at async eval (fetchRequestAdapter.js:176:1)
    at async eval (fetchRequestAdapter.js:163:1)
    at async fetchData (QueryAudioTable.tsx:50:19)
    at async onSubmit (QueryAudioTable.tsx:89:17)
    at async eval (index.esm.mjs:2293:1)

It seems that kiota's serializer is providing a Arraybuffer while the validChunk is expecting a string or Buffer. Maybe something is wrong with the compression middleware? Unfortunately I cannot figure out how to disable the compression middleware

@github-project-automation github-project-automation bot moved this to Needs Triage 🔍 in Kiota Oct 31, 2024
@andrueastman
Copy link
Member

Thanks for raising this @IkeOTL

Unfortunately I cannot figure out how to disable the compression middleware

At the moment, I believe you can use this example to create a httpclient and then pass it to the request adapter constructor.

* KiotaClientFactory.create(undefined, [middleware1, middleware2]);

@rkodev Any chance this is related to compression handler issues at #1442 as well?

@andrueastman andrueastman moved this from Needs Triage 🔍 to Todo 📃 in Kiota Nov 7, 2024
@andrueastman andrueastman added bug Something isn't working type:bug A broken experience labels Nov 7, 2024
@rkodev rkodev self-assigned this Nov 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working type:bug A broken experience
Projects
Status: Todo 📃
Development

No branches or pull requests

3 participants