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

3.1.32 > Error: Could not find ... InternalStreamableUIClient" in the React Client Manifest. #1933

Closed
fullstackwebdev opened this issue Jun 13, 2024 · 2 comments
Labels
ai/rsc bug Something isn't working

Comments

@fullstackwebdev
Copy link

Description

On my nextjs project, when I upgrade to 3.1.32, I get an error when browsing the weather.tsx example code

... However, it works if I downgrade to 3.1.31

Code example

from your docs (PR)

'use client';

import { useState } from 'react';
import { Button } from '@/components/ui/button';
import { streamComponent } from './actions';

export default function Page() {
  const [component, setComponent] = useState<React.ReactNode>();

  return (
    <div>
      <form
        onSubmit={async e => {
          e.preventDefault();
          setComponent(await streamComponent());
        }}
      >
        <Button>Stream Component</Button>
      </form>
      <div>{component}</div>
    </div>
  );
}
'use server';

import { streamUI } from 'ai/rsc';
import { openai } from '@ai-sdk/openai';
import { z } from 'zod';

const LoadingComponent = () => (
  <div className="animate-pulse p-4">getting weather...</div>
);

const getWeather = async (location: string) => {
  await new Promise((resolve) => setTimeout(resolve, 2000));
  return '82°F️ ☀️';
};

interface WeatherProps {
  location: string;
  weather: string;
}

const WeatherComponent = (props: WeatherProps) => (
  <div className="border border-neutral-200 p-4 rounded-lg max-w-fit">
    The weather in {props.location} is {props.weather}
  </div>
);

export async function streamComponent() {
  const result = await streamUI({
    model: openai('gpt-3.5-turbo'),
    prompt: 'Get the weather for San Francisco',
    text: ({ content }) => <div>{content}</div>,
    tools: {
      getWeather: {
        description: 'Get the weather for a location',
        parameters: z.object({
          location: z.string()
        }),
        generate: async function* ({ location }) {
          yield <LoadingComponent />;
          const weather = await getWeather(location);
          return <WeatherComponent weather={weather} location={location} />;
        }
      }
    }
  });

  return result.value;
}

/weather/page.tsx and /weather/actions.tsx

Additional context

 ✓ Compiled in 544ms (804 modules)
 ⨯ Internal error: Error: Could not find the module "/home/fullstack/dev/freegpt.today/node_modules/.pnpm/ai@3.1.32_openai@4.51.0_react@18.3.1_solid-js@1.8.17_svelte@4.2.18_vue@3.4.27_typescript@5.4.5__zod@3.23.8/node_modules/ai/rsc/dist/rsc-shared.mjs#InternalStreamableUIClient" in the React Client Manifest. This is probably a bug in the React Server Components bundler.
    at /home/fullstack/dev/freegpt.today/node_modules/.pnpm/next@14.2.4_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:35:267034
    at eN (/home/fullstack/dev/freegpt.today/node_modules/.pnpm/next@14.2.4_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:35:267229)
    at eF (/home/fullstack/dev/freegpt.today/node_modules/.pnpm/next@14.2.4_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:35:268895)
    at /home/fullstack/dev/freegpt.today/node_modules/.pnpm/next@14.2.4_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:35:265943
    at Array.toJSON (/home/fullstack/dev/freegpt.today/node_modules/.pnpm/next@14.2.4_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:35:266407)
    at stringify (<anonymous>)
    at eq (/home/fullstack/dev/freegpt.today/node_modules/.pnpm/next@14.2.4_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:35:274775)
    at eJ (/home/fullstack/dev/freegpt.today/node_modules/.pnpm/next@14.2.4_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:35:275293)
    at Timeout._onTimeout (/home/fullstack/dev/freegpt.today/node_modules/.pnpm/next@14.2.4_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:35:265080)
    at listOnTimeout (node:internal/timers:573:17)
    at process.processTimers (node:internal/timers:514:7)
digest: "413202499"
 POST /weather 200 in 2650ms
@lgrammel lgrammel added bug Something isn't working ai/rsc labels Jun 13, 2024
@srigari70
Copy link

Same here, any workaround?

@lgrammel
Copy link
Collaborator

#2068

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ai/rsc bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants