Skip to content

bug: content "Send to Workflow" shows a long generic error when no workflow is connected #393

Closed

Description

@gkhngyk

Description

On the Content Opportunities page, clicking Send to Workflow when no workflow (webhook) is connected shows a long, generic error toast instead of a short, meaningful message:

An error occurred in the Server Components render. The specific message is omitted in production builds to avoid leaking sensitive details. A digest property is included on this Error instance which may provide additional details about the nature of the error. …

The toast should be short and human-readable, e.g. "No workflow connected".

Steps to reproduce

  1. Sign in and open Content (/dashboard/content) for a brand that has no active webhook/workflow configured.
  2. On any opportunity, click Send to Workflow (or open an opportunity detail page and click Send).
  3. Observe the error toast.

Note: this only reproduces on a production build (yarn build && yarn start), because Next.js redacts thrown Server Action errors in production. In yarn dev the real message shows.

Expected behavior

A short toast with the real, user-facing reason, e.g. "No workflow connected".

Actual behavior

A long generic toast: "An error occurred in the Server Components render. The specific message is omitted in production builds…".

Deployment mode

Cloud (ansvisor.com) — but the root cause (production build redaction) applies to self-hosted production builds too.


Root cause & suggested fix (for contributors)

web/src/lib/actions/content.ts starts with 'use server', so sendToWebhook is a Server Action. It currently throws on non-OK responses. In production, Next.js redacts thrown Server Action errors and replaces the message with the generic "An error occurred in the Server Components render…" text, so the real message (returned by the server as { error: '...' }) never reaches the client toast.

Suggested approach: for expected/validation failures, return a result object instead of throwing, so the real message survives to the client.

  • In web/src/lib/actions/content.ts, change sendToWebhook to return a discriminated result, e.g. { success: true; ... } | { success: false; error: string }, and return { success: false, error } instead of throwing when !res.ok.
  • Update the two call sites to read the result and toast result.error on failure (keep the catch for truly unexpected errors with a short fallback like 'Failed to send'):
    • web/src/app/[locale]/(dashboard)/dashboard/content/page.tsx → handleSendWebhook
    • web/src/app/[locale]/(dashboard)/dashboard/content/[id]/page.tsx → handleSend
  • Optionally shorten the server-side message in server/src/routes/content.js (the two /send-webhook handlers) from "No active webhook configured for this brand. Set up a webhook first." to something concise like "No workflow connected".

How to verify: run a production build (yarn build && yarn start in web/) and confirm the short toast appears when sending with no workflow connected.

Please follow CONTRIBUTING.md for branch naming and Conventional Commits.

Activity

  1. added
    bug
    good first issue
    on Jul 10, 2026
  2. Sam-syntax35 commented on Jul 10, 2026

    @Sam-syntax35
    Contributor

    Hi @gkhngyk, could you please assign these issues to me? I've already started working on them, and assigning them will help avoid duplicate PRs. Thanks!

  3. gkhngyk commented on Jul 12, 2026

    @gkhngyk
    ContributorAuthor

    Done via #400 (merged) — verified on main: sendToWebhook and bulkSendToWebhook both return structured results and the server message is the short "No workflow connected". The PR lacked a closing keyword, closing manually.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    buggood first issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions