ai icon indicating copy to clipboard operation
ai copied to clipboard

ai/rsc: Deploy with Vercel button broken

Open rikhuijzer opened this issue 3 months ago • 2 comments

Description

I just clicked through the Deploy with Vercel button at

https://github.com/vercel/ai/blob/9d51863453d22896e9244b43cf1c7c0138bdfeb9/examples/next-ai-rsc/README.md?plain=1#L27

and connected via GitLab. The build threw an error (see below for build logs) and the deployed site shows a 404: NOT_FOUND/

Code example

https://github.com/vercel/ai/blob/9d51863453d22896e9244b43cf1c7c0138bdfeb9/examples/next-ai-rsc/README.md?plain=1#L27

Additional context

Running build in Washington, D.C., USA (East) – iad1
Cloning gitlab.com/<HIDDEN>
Previous build cache not available
Cloning completed: 1.551s
Running "vercel build"
Vercel CLI 33.5.3
Installing dependencies...
yarn install v1.22.17
info No lockfile found.
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
warning "ai > [email protected]" has unmet peer dependency "solid-js@^1.2".
warning "ai > [email protected]" has unmet peer dependency "vue@>=3.2.26 < 4".
warning "ai > [email protected]" has unmet peer dependency "svelte@^4.0.0".
[4/4] Building fresh packages...
success Saved lockfile.
Done in 32.68s.
Running "yarn run build"
yarn run v1.22.17
$ next build
Attention: Next.js now collects completely anonymous telemetry regarding usage.
This information is used to shape Next.js' roadmap and prioritize features.
You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL:
https://nextjs.org/telemetry
   ▲ Next.js 14.1.1
   Creating an optimized production build ...
Compiler server unexpectedly exited with code: null and signal: SIGTERM
 ✓ Compiled successfully
   Linting and checking validity of types ...
   Collecting page data ...
 ⚠ Using edge runtime on a page currently disables static generation for that page
   Generating static pages (0/3) ...

 ✓ Generating static pages (3/3) 
   Finalizing page optimization ...
   Collecting build traces ...
Route (app)                              Size     First Load JS
┌ ℇ /                                    5.35 kB         122 kB
└ ○ /_not-found                          886 B          85.4 kB
+ First Load JS shared by all            84.6 kB
  ├ chunks/726-38a3a50a14d8b6c1.js       29.1 kB
  ├ chunks/fd9d1056-8567c763e6940ab4.js  53.4 kB
  └ other shared chunks (total)          2.12 kB
○  (Static)        prerendered as static content
ℇ  (Edge Runtime)  server-rendered on demand using the Edge Runtime
Done in 46.53s.
Build Completed in /vercel/output [1m]
Deploying outputs...
Deployment completed
Uploading build cache [98.27 MB]...
Build cache uploaded: 2.841s

rikhuijzer avatar Mar 04 '24 14:03 rikhuijzer

The error was fixed by running npm update and committing the package-lock.json. Still 404 though.

rikhuijzer avatar Mar 04 '24 14:03 rikhuijzer

Ah fixed the 404 too. The problem was that the aforementioned deploy button doesn't automatically set the build system to Next.js. I manually set the "Framework preset" to "Next.js" and now the build succeeded.

So my problems are fixed, but I'll leave this issue open since the example doesn't work out of the box.

rikhuijzer avatar Mar 04 '24 14:03 rikhuijzer

@MaxLeiter @shuding -- is this related to https://github.com/vercel/ai/pull/1094? I'm getting a [email protected] error hitting the deploy button (even with default framework set to Vercel). I tried re-deploying, as well as making random edits (to force a new deploy).

My solution was to clone the created github repo, run pnpm i, and push the new pnpm-lock.yaml

Deploy button

Screenshot 2024-03-04 at 10 40 08 PM

Redeploying in Vercel

Screenshot 2024-03-04 at 11 02 24 PM

After updating pnpm-lock.yaml

Screenshot 2024-03-04 at 11 15 13 PM Screenshot 2024-03-04 at 11 15 48 PM

conroywhitney avatar Mar 05 '24 05:03 conroywhitney

🙌 fix'd

conroywhitney avatar Mar 06 '24 01:03 conroywhitney

Ah fixed the 404 too. The problem was that the aforementioned deploy button doesn't automatically set the build system to Next.js. I manually set the "Framework preset" to "Next.js" and now the build succeeded.

So my problems are fixed, but I'll leave this issue open since the example doesn't work out of the box.

🙌 fix'd

I just tested, @conroywhitney. The build still generates a 404 page when clicking the deploy button. "Framework preset" is again on "Other" while it should be on "Next.js"

rikhuijzer avatar Mar 06 '24 16:03 rikhuijzer

@rikhuijzer -- weird. I wonder if there's some account settings difference...

What happens if you set &framework=nextjs in the "Deploy on Vercel" link? Could you try this one out?

https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fvercel%2Fai%2Fblob%2Fmain%2Fexamples%2Fnext-ai-rsc&env=OPENAI_API_KEY&envDescription=OpenAI%20API%20Key&envLink=https%3A%2F%2Fplatform.openai.com%2Fapi-keys&framework=nextjs

conroywhitney avatar Mar 07 '24 01:03 conroywhitney

I've tried Firefox and Edge both with a private GitLab repository and your new link. My "Framework Preset" is still "Other" after creating a new project when using that link resulting in a 404 page. The account was made new last week and is using email login. The account email is <MY_FIRST_NAME>.<MY_LAST_NAME>@gmail.com.

I guess if you make a new free account for yourself and the button works there, then all is good. Then maybe indeed my account has some incorrect setting somehow (even though I didn't change anything as far as I remember. I just pressed the deploy button).

rikhuijzer avatar Mar 07 '24 07:03 rikhuijzer