More often than not, requests that include a callback URL should receive an asynchronous response, even if the callback receives an error.
When attempting to transcribe a large audio file, there are multiple reasons you may not receive your transcription.
Some serverless, including popular architecture like Express.s, use bodyParser to understand the body of the request being passed to your application.
By default, bodyParser includes a small default maximum payload size of 100kb, to responsibly limit impact of memory allocation on the server running your application. Essentially, you knowingly need to increase this, and hopefully understand what that would mean for the architecture you’re working on. Especially for serverless environments.
If this limit is reached when Deepgram attempts a callback request, bodyParser will return a 413 Request Entity Too Large response. Your server will most likely log the errors occurance, as it rejects the request from Deepgram.
For bodyParser being used as middleware, you need to configure the parser with a new limit.
To resolve this error in in Next.js API Routes, you need to configure the parser with a new limit. At the top of your API Routes file, include additional config.
Many hosted servers, particularly NGINX based servers, have a maximum payload size for incoming requests. For example, NGINX has a default maximum payload size of 1 MB, which could be insufficient for larger transcripts.
A server will reject a callback due to the transcript size exceeding the payload limit, returning a 413 code and the message Request entity too large/Content too large/Payload too large, depending on which server receives the large payload.
To resolve the “Payload too large” issue for NGINX, follow these steps:
1 MB by default.nginx.conf, and find the client_max_body_size directive (or add it, if it’s missing). Adjust its value to accommodate your transcript size. For example, if your transcript is 5 MB, you may set the value to 5m or higher.service nginx reload will restart the NGINX server.413: Payload too large error should no longer occur.