undefined messages in the body when attaching files larger than ~1 MB in v5
Description
I'm trying to attach images using sendMessage({ text, files }) where files is a FileList. This works fine when images are relatively small, but if they are full size screenshots (larger than approximately 1 MB) then I see a TypeError: Cannot destructure property 'messages' of 'req.body' as it is undefined. error in my backend. Do we need to somehow await until we've fully received the messages object?
const router = express.Router({});
router.post('/chat/:threadId', (async (req, res) => {
const { messages, modelName } = req.body;
}
I don't have this issue with https://ai-sdk-preview-attachments.vercel.app/ only my local v5
AI SDK Version
- ai: 5.0.0-beta.14
Nevermind, was an express limit issue in our config
Identify issue type
Identified as None
Confidence: High
Rationale
This was a configuration/support issue rather than broken AI SDK behavior, and the reporter resolved it by identifying the Express limit.
Evidence
- The reporter initially observed
req.bodybecoming undefined for file uploads larger than approximately 1 MB. - The reporter later confirmed the cause was an Express request-size limit in their own configuration.