Repository: promptfoo/promptfoo
Issue: Trying to self host on ECS but receiving Internal Server Error
Root cause: Configuration Error

I am trying to self host the provided docker file on ECS with Fargate launch type but the following error is occuring when trying to access the port 3000.


`error Failed to handle request for /favicon.ico
TypeError: fetch failed
at node:internal/deps/undici/undici:12618:11
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async invokeRequest (/app/node_modules/next/dist/server/lib/server-ipc/invoke-request.js:21:12)
at async requestHandler (/app/node_modules/next/dist/server/lib/start-server.js:336:33)
at async Server.<anonymous> (/app/node_modules/next/dist/server/lib/start-server.js:152:13) {
cause: Error: connect ECONNREFUSED 127.0.0.1:44759
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1555:16) {
errno: -111,
code: 'ECONNREFUSED',
syscall: 'connect',
address: '127.0.0.1',
port: 44759
}
}
TypeError: fetch failed
at node:internal/deps/undici/undici:12618:11
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async invokeRequest (/app/node_modules/next/dist/server/lib/server-ipc/invoke-request.js:21:12)
at async requestHandler (/app/node_modules/next/dist/server/lib/start-server.js:336:33)
at async Server.<anonymous> (/app/node_modules/next/dist/server/lib/start-server.js:152:13) {
cause: Error: connect ECONNREFUSED 127.0.0.1:44759
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1555:16) {
errno: -111,
code: 'ECONNREFUSED',
syscall: 'connect',
address: '127.0.0.1',
port: 44759
}
}
- error Failed to handle request for /`

I think I am missing something.

Can you confirm that you set the build args and environment variables from
the Setup guide? https://promptfoo.dev/docs/usage/self-hosting/#setup

On Fri, Apr 19, 2024 at 8:07 AM CarlosEduardo ***@***.***>
wrote:

> I am trying to self host the provided docker file on ECS with Fargate
> launch type but the following error is occuring when trying to access the
> port 3000.
>
> `error Failed to handle request for /favicon.ico
> TypeError: fetch failed
> at node:internal/deps/undici/undici:12618:11
> at process.processTicksAndRejections
> (node:internal/process/task_queues:95:5)
> at async invokeRequest
> (/app/node_modules/next/dist/server/lib/server-ipc/invoke-request.js:21:12)
> at async requestHandler
> (/app/node_modules/next/dist/server/lib/start-server.js:336:33)
> at async Server.
> (/app/node_modules/next/dist/server/lib/start-server.js:152:13) {
> cause: Error: connect ECONNREFUSED 127.0.0.1:44759
> at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1555:16) {
> errno: -111,
> code: 'ECONNREFUSED',
> syscall: 'connect',
> address: '127.0.0.1',
> port: 44759
> }
> }
> TypeError: fetch failed
> at node:internal/deps/undici/undici:12618:11
> at process.processTicksAndRejections
> (node:internal/process/task_queues:95:5)
> at async invokeRequest
> (/app/node_modules/next/dist/server/lib/server-ipc/invoke-request.js:21:12)
> at async requestHandler
> (/app/node_modules/next/dist/server/lib/start-server.js:336:33)
> at async Server.
> (/app/node_modules/next/dist/server/lib/start-server.js:152:13) {
> cause: Error: connect ECONNREFUSED 127.0.0.1:44759
> at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1555:16) {
> errno: -111,
> code: 'ECONNREFUSED',
> syscall: 'connect',
> address: '127.0.0.1',
> port: 44759
> }
> }
>
>    - error Failed to handle request for /`
>
> I think I am missing something.
>
> —
> Reply to this email directly, view it on GitHub
> <https://github.com/promptfoo/promptfoo/issues/693>, or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AACLYJSEV4N7KOQDQZPSMX3Y6EXLJAVCNFSM6AAAAABGPLMGGCVHI2DSMVQWIX3LMV43ASLTON2WKOZSGI2TGMRUGAYDGMA>
> .
> You are receiving this because you are subscribed to this thread.Message
> ID: ***@***.***>
>


Yes, I built it locally with 
`docker build --build-arg NEXT_PUBLIC_PROMPTFOO_BASE_URL=http://localhost:3000 -t promptfoo-ui .`
And  provided port 3000 and openai envs in the ecs task launch

@github-carlos Did you find out what were you missing?

Hi @github-carlos @alfredo-medina-stx, 

We’ve shipped a number of improvements to the build process since this issue was raised, and it should now be resolved. Please check out the updated self-hosting guide here: https://www.promptfoo.dev/docs/usage/self-hosting/.

If you continue to run into any issues, feel free to re-open this issue or reach out. Thanks again for your patience, and we really appreciate your contributions to the community!