Dark Mode

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Socket hangs up on upload of attachment #444

Open
Open
Socket hangs up on upload of attachment#444
Labels

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?filena me=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-zendesk version: ^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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions