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

Fix ERR_FR_MAX_BODY_LENGTH_EXCEEDED issue by setting default maxBodyLength #191

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix: set maxBodyLength default to 25 MB
- increases the default file size limit to 25MB to accomodate the `createTranscript` API size limit
  • Loading branch information
es-lynn committed Jul 5, 2023
commit fc55bdf337ecf3c25cf52e08be1f4906ff60c84f
3 changes: 3 additions & 0 deletions configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ export class Configuration {
'Authorization': `Bearer ${this.apiKey}`,
...this.baseOptions.headers,
}
if (this.baseOptions.maxBodyLength == null) {
this.baseOptions.maxBodyLength = 25 * 1024 * 1024; // 25MB
}
if (this.organization) {
this.baseOptions.headers['OpenAI-Organization'] = this.organization;
}
Expand Down
3 changes: 3 additions & 0 deletions dist/configuration.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ class Configuration {
this.baseOptions = {};
}
this.baseOptions.headers = Object.assign({ 'User-Agent': `OpenAI/NodeJS/${packageJson.version}`, 'Authorization': `Bearer ${this.apiKey}` }, this.baseOptions.headers);
if (this.baseOptions.maxBodyLength == null) {
this.baseOptions.maxBodyLength = 25 * 1024 * 1024; // 25MB
}
if (this.organization) {
this.baseOptions.headers['OpenAI-Organization'] = this.organization;
}
Expand Down