Skip to content

bun run start-bin not working local setup #303

@Siafu

Description

@Siafu

Following the local setup guide
https://github.com/CodebuffAI/codebuff/blob/main/CONTRIBUTING.md

Step running bun run start-bin just hangs with output:

codebuff/npm-app > 
Could not connect. Retrying...

Troubleshooting:
Confirmed its not a network or firewall issue.
I am able to run wscat -c ws://localhost:4242/ws successfully.

Configured .env

# AI API Keys
ANTHROPIC_API_KEY=dummy_anthropic_key
ANTHROPIC_API_KEY2=dummy_anthropic_key_2
OPEN_AI_KEY=sk-proj-CONFIGURED
GEMINI_API_KEY=dummy_gemini_key
DEEPSEEK_API_KEY=dummy_deepseek_key
OPEN_ROUTER_API_KEY=sk-or-v1-CONFIGURED
HELICONE_API_KEY=dummy_helicone_key

# Database & Server
DATABASE_URL=postgresql://manicode_user_local:secretpassword_local@db.manicode.orb.local:5432/manicode_db_local
PORT=4242
GOOGLE_CLOUD_PROJECT_ID=dummy_project_id

# Authentication
CODEBUFF_GITHUB_ID=Ov2-CONFIGURED
CODEBUFF_GITHUB_SECRET=a8-CONFIGURED
NEXTAUTH_SECRET=dummy_nextauth_secret_at_least_32_chars_long
API_KEY_ENCRYPTION_SECRET=dummy_encryption_secret_32_chars

# Payment (Stripe)
STRIPE_SECRET_KEY=sk_test_dummy_stripe_secret
STRIPE_WEBHOOK_SECRET_KEY=whsec_dummy_webhook_secret
STRIPE_USAGE_PRICE_ID=price_dummy_usage_id
STRIPE_TEAM_FEE_PRICE_ID=price_dummy_team_fee_id

# External Services
RELACE_API_KEY=dummy_relace_key
LINKUP_API_KEY=dummy_linkup_key
LOOPS_API_KEY=dummy_loops_key

# Discord Integration
DISCORD_PUBLIC_KEY=dummy_discord_public_key
DISCORD_BOT_TOKEN=dummy_discord_bot_token
DISCORD_APPLICATION_ID=dummy_discord_app_id

# Frontend/Public Variables
NEXT_PUBLIC_CB_ENVIRONMENT=development
NEXT_PUBLIC_CODEBUFF_APP_URL=http://localhost:3000
NEXT_PUBLIC_CODEBUFF_BACKEND_URL=http://localhost:4242
NEXT_PUBLIC_SUPPORT_EMAIL=support@codebuff.com
NEXT_PUBLIC_POSTHOG_API_KEY=phc_CONFIGURED
NEXT_PUBLIC_POSTHOG_HOST_URL=https://app.posthog.com
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_test_dummy_publishable
NEXT_PUBLIC_STRIPE_CUSTOMER_PORTAL=https://billing.stripe.com/p/login/test_dummy
NEXT_PUBLIC_WEB_PORT=3000

running back-end

$ bun --cwd backend dev
$ bun src/index.ts
Using environment: development
{"level":"DEBUG","timestamp":"2025-09-18T16:05:22.912Z","pid":181906,"hostname":"siafu-dev","msg":"🚀 Server is running on port 4242"}
🚀 Server is running on port 4242
{"level":"INFO","timestamp":"2025-09-18T16:05:22.913Z","pid":181906,"hostname":"siafu-dev","msg":"Web socket server listening on /ws."}
MetadataLookupWarning: received unexpected error = Unable to connect. Is the computer able to access the url? code = ConnectionRefused
      at isAvailable (/home/siafu/Projects/codebuff/node_modules/gcp-metadata/build/src/index.js:356:25)
      at async _checkIsGCE (/home/siafu/Projects/codebuff/node_modules/google-auth-library/build/src/auth/googleauth.js:300:69)
      at async getApplicationDefaultAsync (/home/siafu/Projects/codebuff/node_modules/google-auth-library/build/src/auth/googleauth.js:283:24)
      at async _GoogleAuth_determineClient (/home/siafu/Projects/codebuff/node_modules/google-auth-library/build/src/auth/googleauth.js:834:43)
      at async getClient (/home/siafu/Projects/codebuff/node_modules/google-auth-library/build/src/auth/googleauth.js:698:26)
      at async authorizeRequest (/home/siafu/Projects/codebuff/node_modules/google-auth-library/build/src/auth/googleauth.js:741:35)

{"level":"ERROR","timestamp":"2025-09-18T16:05:37.377Z","pid":181906,"hostname":"siafu-dev","error":{},"stack":"Error: Could not load the default credentials. Browse to https://cloud.google.com/docs/authentication/getting-started for more information.\n    at getApplicationDefaultAsync (/home/siafu/Projects/codebuff/node_modules/google-auth-library/build/src/auth/googleauth.js:287:19)\n    at async _GoogleAuth_determineClient (/home/siafu/Projects/codebuff/node_modules/google-auth-library/build/src/auth/googleauth.js:834:43)\n    at async getClient (/home/siafu/Projects/codebuff/node_modules/google-auth-library/build/src/auth/googleauth.js:698:26)\n    at async authorizeRequest (/home/siafu/Projects/codebuff/node_modules/google-auth-library/build/src/auth/googleauth.js:741:35)\n    at processTicksAndRejections (native:7:39)","message":"Could not load the default credentials. Browse to https://cloud.google.com/docs/authentication/getting-started for more information.","name":"Error","msg":"Failed to initialize BigQuery client"}

front-end

$ bun start-db && bun --cwd web dev
$ bun --cwd common db:start
$ docker compose -f ./src/db/docker-compose.yml up --wait && bun run db:generate && (timeout 1 || sleep 1) && bun run db:migrate
[+] Running 1/1
 ✔ Container manicode-db-1  Healthy                                                                          0.5s 
$ drizzle-kit generate --config=./src/db/drizzle.config.ts
Reading config file '/home/siafu/Projects/codebuff/common/src/db/drizzle.config.ts'
Using environment: development
20 tables
account 11 columns 0 indexes 1 fks
agent_config 9 columns 1 indexes 1 fks
agent_run 18 columns 11 indexes 1 fks
agent_step 12 columns 3 indexes 1 fks
credit_ledger 10 columns 2 indexes 2 fks
encrypted_api_keys 3 columns 0 indexes 1 fks
fingerprint 3 columns 0 indexes 0 fks
git_eval_results 8 columns 0 indexes 0 fks
message 18 columns 4 indexes 2 fks
org 18 columns 0 indexes 1 fks
org_feature 6 columns 1 indexes 1 fks
org_invite 10 columns 3 indexes 3 fks
org_member 4 columns 0 indexes 2 fks
org_repo 8 columns 2 indexes 2 fks
publisher 11 columns 0 indexes 3 fks
referral 6 columns 0 indexes 2 fks
session 5 columns 0 indexes 2 fks
sync_failure 6 columns 1 indexes 0 fks
user 17 columns 0 indexes 0 fks
verificationToken 3 columns 0 indexes 0 fks

No schema changes, nothing to migrate 😴
Try 'timeout --help' for more information.
$ drizzle-kit push --config=./src/db/drizzle.config.ts
Reading config file '/home/siafu/Projects/codebuff/common/src/db/drizzle.config.ts'
Using environment: development
Using 'pg' driver for database querying
[✓] Pulling schema from database...
agent_config_publisher_id_id_version_pk agent_config_publisher_id_id_version_pk
agent_config_publisher_id_id_version_pk agent_config_publisher_id_id_version_pk
[✓] Changes applied
$ next dev -p ${NEXT_PUBLIC_WEB_PORT:-3000}
  ▲ Next.js 14.2.13
  - Local:        http://localhost:3000

 ✓ Starting...
   automatically enabled Fast Refresh for 1 custom loader
Contentlayer config change detected. Updating type definitions and data...
successCallback /home/siafu/Projects/codebuff/web/.contentlayer
Generated 22 documents in .contentlayer
 ✓ Ready in 2.9s
 ○ Compiling /api/agents/validate ...
 ✓ Compiled /api/agents/validate in 880ms (335 modules)
Using environment: development
 POST /api/agents/validate 200 in 1246ms

web.log

Reading config file '/home/siafu/Projects/codebuff/common/src/db/drizzle.config.ts'
Using environment: development
20 tables
account 11 columns 0 indexes 1 fks
agent_config 9 columns 1 indexes 1 fks
agent_run 18 columns 11 indexes 1 fks
agent_step 12 columns 3 indexes 1 fks
credit_ledger 10 columns 2 indexes 2 fks
encrypted_api_keys 3 columns 0 indexesTry 'timeout --help' for more information.
$ drizzle-kit push --config=./src/db/drizzle.config.ts
$ next dev -p ${NEXT_PUBLIC_WEB_PORT:-3000}
 ⨯ Failed to start server
Error: listen EADDRINUSE: address already in use :::3000
    at Server.setupListenHandle [as _listen2] (node:net:1940:16)
    at listenInCluster (node:net:1997:12)
    at Server.listen (node:net:2102:7)
    at /home/siafu/Projects/codebuff/node_modules/next/dist/server/lib/start-server.js:280:16
    at new Promise (<anonymous>)
    at startServer (/home/siafu/Projects/codebuff/node_modules/next/dist/server/lib/start-server.js:191:11)
    at /home/siafu/Projects/codebuff/node_modules/next/dist/server/lib/start-server.js:310:52
    at Span.traceAsyncFn (/home/siafu/Projects/codebuff/node_modules/next/dist/trace/trace.js:154:26)
    at process.<anonymous> (/home/siafu/Projects/codebuff/node_modules/next/dist/server/lib/start-server.js:310:35)
    at process.emit (node:events:519:28) {
  code: 'EADDRINUSE',
  errno: -98,
  syscall: 'listen',
  address: '::',
  port: 3000
}
_version_pk agent_config_publisher_id_id_version_pk
[✓] Changes applied
�[?25h

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions