Skip to content

Doesn't work in next.js project: Uncaught Error: Objects are not valid as a React child #37

@itsmepetrov

Description

@itsmepetrov

I have the following setup:

// pages/system/queue/[[...slug]].tsx

import { QueueDashApp } from "@queuedash/ui";

function QueueDashPages() {
  return (
    <QueueDashApp
      apiUrl="/api/system/queue"
      basename="/system/queue"
    />
  );
};

export default QueueDashPages;
// pages/api/system/queue/[trpc].ts

import { Queue } from "bullmq";
import * as trpcNext from "@trpc/server/adapters/next";
import { appRouter } from "@queuedash/api";
import RedisService from "server/services/redis";

const connection = RedisService.createClient({
  maxRetriesPerRequest: null,
});

const queue = new Queue("main", {
  connection,
});

export default trpcNext.createNextApiHandler({
  router: appRouter,
  batching: {
    enabled: true,
  },
  createContext: () => ({
    queues: [
      {
        queue,
        displayName: "Main",
        type: "bullmq" as const,
      },
    ],
  }),
});

When I try to load the page it throws an error:

helpers.js:121 Uncaught Error: Objects are not valid as a React child (found: object with keys {$$typeof, type, key, ref, props}). If you meant to render a collection of children, use an array instead.

client.js:2 The above error occurred in the <US> component:
    at US (webpack-internal:///./node_modules/@queuedash/ui/dist/main.mjs:20598:13)
    at QueueDashPages
    at WithSuperJSON (webpack-internal:///./node_modules/babel-plugin-superjson-next/dist/tools.js:115:55)
...
Screenshot 2024-12-12 at 10 13 03

Next.js: 13.5.6
Queuedash: 3.2.0

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