Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ECONNREFUSED on localhost #15

Open
rtdean93 opened this issue Sep 30, 2024 · 4 comments
Open

ECONNREFUSED on localhost #15

rtdean93 opened this issue Sep 30, 2024 · 4 comments
Labels
enhancement New feature or request invalid This doesn't seem right

Comments

@rtdean93
Copy link

Description

I have followed your docs at https://baseai.dev/learn/run-pipe and https://github.com/LangbaseInc/baseai/tree/main/examples/nextjs

I entered my OpenAI key (and even regenerated a new project key) and also added a LangBase key.

I continue to get the following error connecting to :9000 even though the service is running.

APIConnectionError: Connection error.
at Request.send (/Users/bobby/Developer/my-ai-project/node_modules/@baseai/core/src/common/request.ts:55:10)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at Pipe.run (/Users/bobby/Developer/my-ai-project/node_modules/@baseai/core/src/pipes/pipes.ts:192:18)
at main (/Users/bobby/Developer/my-ai-project/index.ts:15:21) {
status: undefined,
headers: undefined,
request_id: undefined,
error: undefined,
code: undefined,
cause: TypeError: fetch failed
at node:internal/deps/undici/undici:12618:11
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at Request.makeRequest (/Users/bobby/Developer/my-ai-project/node_modules/@baseai/core/src/common/request.ts:103:16)
at Request.send (/Users/bobby/Developer/my-ai-project/node_modules/@baseai/core/src/common/request.ts:49:15)
at Pipe.run (/Users/bobby/Developer/my-ai-project/node_modules/@baseai/core/src/pipes/pipes.ts:192:18)
at main (/Users/bobby/Developer/my-ai-project/index.ts:15:21) {
cause: Error: connect ECONNREFUSED ::1:9000
at __node_internal_captureLargerStackTrace (node:internal/errors:496:5)
at __node_internal_exceptionWithHostPort (node:internal/errors:671:12)
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1555:16) {
errno: -61,
code: 'ECONNREFUSED',
syscall: 'connect',
address: '::1',
port: 9000
}

Code example

No response

Additional context

No response

@msaaddev
Copy link
Member

msaaddev commented Sep 30, 2024

Hi @rtdean93 – Thanks for reaching out! Have you started the BaseAI dev server in your project using

npx baseai@latest dev

If not, please run it and try it again. Here is a quick guide to help you how you can do it: https://baseai.dev/docs/pipe/quickstart#step-6-start-baseai-server

@ahmadawais
Copy link
Member

We need to handle this paper cut better. It's on our todo list. @msaaddev @ahmadbilaldev, please prioritize this.

@rtdean93 glad to see you're already trying it out. As @msaaddev mentioned. You are not running your baseai server. Which currently only support 9000 port and can be run by npx baseai@latest dev command in a new terminal.

So you'll be running Next.js dev server in one terminal and BaseAI dev server in another. At the same time.

Closing the issue. Let us know if you still got a problem.

@ahmadawais ahmadawais added enhancement New feature or request invalid This doesn't seem right labels Sep 30, 2024
@rtdean93
Copy link
Author

rtdean93 commented Sep 30, 2024 via email

@ahmadawais ahmadawais reopened this Oct 1, 2024
@ahmadawais
Copy link
Member

It looks like something else is running on port 9000 like a PHP server?

Have you tried killing the 9000 port and trying again?

Error: connect ECONNREFUSED ::1:9000

From Claude:

To find and terminate a process using port 9000 on a Mac, you can follow these steps:

  1. Open Terminal on your Mac.

  2. Run the following command to find the process ID (PID) using port 9000:

lsof -i :9000

This will display information about any process using port 9000, including its PID.

  1. If a process is found, note its PID from the output.

  2. To terminate the process, use the kill command followed by the PID:

kill <PID>

Replace <PID> with the actual process ID you found in step 3.

  1. If the process doesn't terminate, you can use a stronger termination signal:
kill -9 <PID>

This forcefully terminates the process.

  1. Verify that the port is no longer in use by running the lsof command again:
lsof -i :9000

If no output is displayed, the port is now free.

Then try again.

Let me know how it goes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

3 participants