"The document has no pages." error using AWS S3 signed urls and Gemini 3 Flash/Pro Preview

When using larger pdfs (e.g. 20MB) from AWS S3 as signed urls in the parts then I receive the error:

ApiError: {“error”:{“code”:400,“message”:“The document has no pages.”,“status”:“INVALID_ARGUMENT”}}

The api call looks like this:

vertexAI.models.generateContent({
          model: 'gemini-3-flash-preview',
          contents: [
            {
              role: 'user',
              parts: [
{"fileData":{"fileUri":"https://abc.s3.eu-central-1.amazonaws.com/abc/dcg.pdf?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=abc%2F20260116%2Feu-central-1%2Fs3%2Faws4_request&X-Amz-Date=20260116T151901Z&X-Amz-Expires=600&X-Amz-Signature=abc&X-Amz-SignedHeaders=host&x-amz-checksum-mode=ENABLED&x-id=GetObject","mimeType":"application/pdf"}}, { text: "user-prompt" }],
            },
          ],
          config: {
            responseMimeType: 'application/json',
            responseSchema,
            seed: this.SEED,
            systemInstruction: [{ text: "systemPrompt }],
            thinkingConfig: {
              thinkingLevel: ThinkingLevel.HIGH,
            },
          },
        })


I’m using version 1.37.0 of genai/js

In VertexAI Studio it’s the same!

Also when using VertexAI Studio and entering the file via the link

I get the same error

Opening the link in the browser works fine and the pdf looks good, also in Adobe

Having the same issue with Azure SAS URLs

1 Like