Azure-Samples / azure-search-openai-javascript

A TypeScript sample app for the Retrieval Augmented Generation pattern running on Azure, using Azure AI Search for retrieval and Azure OpenAI and LangChain large language models (LLMs) to power ChatGPT-style and Q&A experiences.
MIT License
254 stars 132 forks source link

Get "431 - Request Header Fields Too Large" when run locally #208

Closed dlauterbach closed 1 month ago

dlauterbach commented 5 months ago

Please provide us with the following information:

This issue is for a: (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

Any log messages given by the failure

[search] [App] [14:15:02.364] INFO (82308): incoming request
[search] [App]     reqId: "req-1"
[search] [App]     req: {
[search] [App]       "method": "POST",
[search] [App]       "url": "/chat",
[search] [App]       "hostname": "127.0.0.1:3000",
[search] [App]       "remoteAddress": "127.0.0.1",
[search] [App]       "remotePort": 57761
[search] [App]     }
[search] [App] [14:15:04.440] ERROR (82308): 431 <html>
[search] [App]   <head>
[search] [App]     <title>Request Header Fields Too Large</title>
[search] [App]   </head>
[search] [App]   <body>
[search] [App]     <h1><p>Request Header Fields Too Large</p></h1>
[search] [App]     Error parsing headers: &#x27;limit request headers fields size&#x27;
[search] [App]   </body>
[search] [App] </html>
[search] [App]
[search] [App]     err: {
[search] [App]       "type": "APIError",
[search] [App]       "message": "431 <html>\n  <head>\n    <title>Request Header Fields Too Large</title>\n  </head>\n  <body>\n    <h1><p>Request Header Fields Too Large</p></h1>\n    Error parsing headers: &#x27;limit request headers fields size&#x27;\n  </body>\n</html>\n",
[search] [App]       "stack":
[search] [App]           Error: 431 <html>
[search] [App]             <head>
[search] [App]               <title>Request Header Fields Too Large</title>
[search] [App]             </head>
[search] [App]             <body>
[search] [App]               <h1><p>Request Header Fields Too Large</p></h1>
[search] [App]               Error parsing headers: &#x27;limit request headers fields size&#x27;
[search] [App]             </body>
[search] [App]           </html>
[search] [App]
[search] [App]               at APIError.generate (file:///C:/Dan/git/EMR-ENT-IT-ETO-Search-Chatbot/azure-search-openai/azure-search-openai-javascript/node_modules/openai/error.mjs:63:16)
[search] [App]               at OpenAI.makeStatusError (file:///C:/Dan/git/EMR-ENT-IT-ETO-Search-Chatbot/azure-search-openai/azure-search-openai-javascript/node_modules/openai/core.mjs:256:25)
[search] [App]               at OpenAI.makeRequest (file:///C:/Dan/git/EMR-ENT-IT-ETO-Search-Chatbot/azure-search-openai/azure-search-openai-javascript/node_modules/openai/core.mjs:299:30)
[search] [App]               at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
[search] [App]               at async ChatReadRetrieveRead.baseRun (file:///C:/Dan/git/EMR-ENT-IT-ETO-Search-Chatbot/azure-search-openai/azure-search-openai-javascript/packages/search/dist/lib/approaches/chat-read-retrieve-read.js:100:32)
[search] [App]               at async ChatReadRetrieveRead.runWithStreaming (file:///C:/Dan/git/EMR-ENT-IT-ETO-Search-Chatbot/azure-search-openai/azure-search-openai-javascript/packages/search/dist/lib/approaches/chat-read-retrieve-read.js:67:61)
[search] [App]               at async Object.handler (file:///C:/Dan/git/EMR-ENT-IT-ETO-Search-Chatbot/azure-search-openai/azure-search-openai-javascript/packages/search/dist/routes/root.js:83:38)
[search] [App]       "status": 431,
[search] [App]       "headers": {
[search] [App]         "apim-request-id": "1f94c187-b784-4681-bcc9-81a360c84bd6",
[search] [App]         "azureml-model-session": "d087-20240605110909",
[search] [App]         "content-length": "229",
[search] [App]         "content-type": "text/html",
[search] [App]         "date": "Wed, 19 Jun 2024 20:15:10 GMT",
[search] [App]         "ms-azureml-model-error-reason": "model_error",
[search] [App]         "ms-azureml-model-error-statuscode": "431",
[search] [App]         "strict-transport-security": "max-age=31536000; includeSubDomains; preload",
[search] [App]         "x-content-type-options": "nosniff",
[search] [App]         "x-envoy-upstream-service-time": "5",
[search] [App]         "x-ms-client-request-id": "Not-Set",
[search] [App]         "x-ms-rai-invoked": "true",
[search] [App]         "x-ms-region": "East US 2",
[search] [App]         "x-ratelimit-remaining-requests": "29",
[search] [App]         "x-ratelimit-remaining-tokens": "29968",
[search] [App]         "x-request-id": "2e1d2ba2-aea5-412f-89f8-58de050a696b"
[search] [App]       }
[search] [App]     }
[search] [App] [14:15:04.441] ERROR (82308): 431 <html>
[search] [App]   <head>
[search] [App]     <title>Request Header Fields Too Large</title>
[search] [App]   </head>
[search] [App]   <body>
[search] [App]     <h1><p>Request Header Fields Too Large</p></h1>
[search] [App]     Error parsing headers: &#x27;limit request headers fields size&#x27;
[search] [App]   </body>
[search] [App] </html>
[search] [App]
[search] [App]     reqId: "req-1"
[search] [App]     req: {
[search] [App]       "method": "POST",
[search] [App]       "url": "/chat",
[search] [App]       "hostname": "127.0.0.1:3000",
[search] [App]       "remoteAddress": "127.0.0.1",
[search] [App]       "remotePort": 57761
[search] [App]     }
[search] [App]     res: {
[search] [App]       "statusCode": 500
[search] [App]     }
[search] [App]     err: {
[search] [App]       "type": "InternalServerError",
[search] [App]       "message": "431 <html>\n  <head>\n    <title>Request Header Fields Too Large</title>\n  </head>\n  <body>\n    <h1><p>Request Header Fields Too Large</p></h1>\n    Error parsing headers: &#x27;limit request headers fields size&#x27;\n  </body>\n</html>\n",
[search] [App]       "stack":
[search] [App]           InternalServerError: 431 <html>
[search] [App]             <head>
[search] [App]               <title>Request Header Fields Too Large</title>
[search] [App]             </head>
[search] [App]             <body>
[search] [App]               <h1><p>Request Header Fields Too Large</p></h1>
[search] [App]               Error parsing headers: &#x27;limit request headers fields size&#x27;
[search] [App]             </body>
[search] [App]           </html>
[search] [App]
[search] [App]               at Object.internalServerError (C:\Dan\git\EMR-ENT-IT-ETO-Search-Chatbot\azure-search-openai\azure-search-openai-javascript\node_modules\@fastify\sensible\lib\httpErrors.js:137:19)
[search] [App]               at _Reply.internalServerError (C:\Dan\git\EMR-ENT-IT-ETO-Search-Chatbot\azure-search-openai\azure-search-openai-javascript\node_modules\@fastify\sensible\index.js:50:42)
[search] [App]               at Object.handler (file:///C:/Dan/git/EMR-ENT-IT-ETO-Search-Chatbot/azure-search-openai/azure-search-openai-javascript/packages/search/dist/routes/root.js:98:30)
[search] [App]               at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
[search] [App]       "explicitInternalServerError": true,
[search] [App]       "status": 500,
[search] [App]       "statusCode": 500,
[search] [App]       "expose": false
[search] [App]     }
[search] [App] [14:15:04.443] INFO (82308): request completed
[search] [App]     reqId: "req-1"
[search] [App]     res: {
[search] [App]       "statusCode": 500
[search] [App]     }
[search] [App]     responseTime: 2078.274699985981
[search] [App] [14:15:04.443] INFO (82308): stream closed prematurely
[search] [App]     reqId: "req-1"
[search] [App]     res: {
[search] [App]       "statusCode": 500
[search] [App]     }

Expected/desired behavior

OS and Version?

Windows 10

azd version?

azd version 1.9.3 (commit e1624330dcc7dde440ecc1eda06aac40e68aa0a3)

Versions

Mention any other details that might be useful


Thanks! We'll be in touch soon.

github-actions[bot] commented 1 month ago

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this issue will be closed.

github-actions[bot] commented 1 month ago

This issue was closed because it has been stalled for 7 days with no activity.