-
-
Notifications
You must be signed in to change notification settings - Fork 237
Description
Describe the Bug
When using the attachments.upload method to upload a Buffer the operation fails after some time with the Error message FetchError: request to https://{{subdomain}}.zendesk.com/api/v2/uploads.json?filename=checks-1752169906180.json&binary=true failed, reason: socket hang up
Example Code
this.client = new ZendeskClient({
customHeaders: {
Authorization:
'Basic ' + this.configService.getOrThrow('ZENDESK_AUTH_TOKEN'),
},
username: this.configService.getOrThrow('ZENDESK_USERNAME'),
subdomain: this.configService.getOrThrow('ZENDESK_SUBDOMAIN'),
});
const file = new Buffer('[{ "example": 1 }]', 'utf-8');
const filename = `example-file.json`;
await this.client.attachments.upload(file, { filename, binary: true });Expected Behavior
Converting a string to a Buffer and then uploading it with the attachments.upload method returns the token for the uploaded file
Actual Behavior
Tried to upload an attachment by receiving the content of a file in a HTTP request, converting it into a Buffer and then using the attachments.upload method but the following error was thrown:
Environment Information
node-zendeskversion: ^5.0.12- Node.js version: 20.19.1
- Operating System: Windows
- Any other relevant software versions? No
Additional Context
Using the zendesk API directly for attachment uploads does not produce that error, nor does using any other method from the library. The error happens with other file types as well.