Skip to content

Chat API throws 503 error: Integration broken due to missing profile.md #5

Description

@Emlembow

Bug Description

When attempting to use the chat feature, the application fails and throws a 503 Service Unavailable error. The console displays multiple related errors indicating failure to load content/profile.md and unsuccessful API calls to /api/chat, resulting in a service outage. Example logs:

{error: "Service temporarily unavailable",…}
details: "Failed to build system prompt: Failed to build system prompt: Failed to load content: Cannot read file content/profile.md: ENOENT: no such file or directory, open '/var/task/content/profile.md'"
error: "Service temporarily unavailable"
POST https://dwa-rho.vercel.app/api/chat 503 (Service Unavailable)

Steps to Reproduce

  1. Open the chat interface in the app.
  2. Attempt to send a message (e.g., "Tell me more").
  3. Observe the 503 error and console logs in the browser.

Expected Behavior

The chat should respond to user messages using the OpenAI API, returning appropriate answers.

Actual Behavior

  • The API returns a 503 error.
  • Console output shows failures to read content/profile.md and indicates the file is missing or cannot be loaded.
  • No chat response is delivered to the user.

Suggested Fix

  • Ensure content/profile.md exists and is accessible to the deployed environment.
  • Review the chat integration code. Consider using a tested approach, as in the following example:
import OpenAI from "openai";

const openai = new OpenAI({
  apiKey: process.env.OPENAI_API_KEY,
});

const response = await openai.responses.create({
  model: "gpt-4.1-nano",
  input: [
    { role: "system", content: [{ type: "input_text", text: "# Purpose\nYou are a resume assistant for Jordan.\n..." }] },
    { role: "user", content: [{ type: "input_text", text: "Tell me more" }] }
  ],
  text: { format: { type: "text" } },
  reasoning: {},
  tools: [],
  temperature: 1,
  max_output_tokens: 200,
  top_p: 1,
  store: true
});
  • Confirm that file dependencies like profile.md are built, committed, and deployed as needed.

Additional Context

  • 503 error occurs on all chat attempts.
  • Error reproducible in deployed environment.
  • Example API and working integration included above for reference.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions