stackblitz / bolt.new

Prompt, run, edit, and deploy full-stack web applications
https://bolt.new
MIT License
5.75k stars 1.47k forks source link

installing code from v0 is not working with `shadcn add` #40

Open TimPietrusky opened 3 weeks ago

TimPietrusky commented 3 weeks ago

Describe the bug

When telling bolt to run npx shadcn add "https://v0.dev/chat/b/<id>", it will fail with this error: request to [https://v0.dev/chat/b/](https://t.co/TE5EKUYAZF)<id>/json failed, reason: socket hang up

Link to the Bolt URL that caused the error

https://bolt.new/~/sb1-esspt2

Steps to reproduce

  1. Execute the prompt: "create a next, react, shadcn project and run this command: npx shadcn add "https://v0.dev/chat/b/<id>""
  2. See in the terminal, that the error is triggered

Expected behavior

I can just install any blocks from v0.

Screen Recording / Screenshot

No response

Platform

Additional context

https://x.com/stackblitz/status/1842336979939422604

Nemikolh commented 2 weeks ago

Hey @TimPietrusky!

Ah, I think this is because it's running into a CORS issue. It would work if https://v0.dev/chat/b/<id> was served with Access-Control-Allow-Origin set to * or if returned the origin which sent the request, returning something like https://<unique>.w-credentialless-staticblitz.com/.

We do have a CORS proxy though on StackBlitz, but I believe it hasn't been ported over the WebContainer API yet.