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

help to deploy on vercel #1

Open
robotpapier opened this issue Jun 12, 2023 · 6 comments
Open

help to deploy on vercel #1

robotpapier opened this issue Jun 12, 2023 · 6 comments

Comments

@robotpapier
Copy link

Hi @suhaildawood , thanks for this example of sveltekit + websocket.
Works perfectly in development.

But I can't deploy it to vercel, can you give some clues on how we could make this work?
I have this error on Vercel build :

Error: No Output Directory named "public" found after the Build completed. You can configure the Output Directory in your Project Settings.

Thanks

@lnfel
Copy link

lnfel commented Jul 4, 2023

@robotpapier vercel and sveltekit has a comprehensive guide about deployment.

https://vercel.com/docs/frameworks/sveltekit
https://kit.svelte.dev/docs/adapter-vercel

Using vercel adapter will build your app in public folder, it seems your svelte.config.js is not set properly.

@suhaildawood
Copy link
Owner

Glad it was helpful @robotpapier ! This example uses @sveltejs/adapter-node so you'll need a server capable of running the built Node.js script. From what I can tell Vercel does not support WebSocket servers as part of their serverless function offering so I doubt you'll be able to use the Vercel adapter. One option you could look into is Cloudflare - it looks like they do offer support for WebSocket servers within Cloudflare Workers.

If your use case doesn't involve a lot of traffic I'd suggest hosting your site on a small server like the Amazon T2.micro EC2 instance.

@robotpapier
Copy link
Author

@suhaildawood yeah indeed I saw that afterwards, thanks for the tips ! :)

@aeviou
Copy link

aeviou commented Aug 20, 2023

Glad it was helpful @robotpapier ! This example uses @sveltejs/adapter-node so you'll need a server capable of running the built Node.js script. From what I can tell Vercel does not support WebSocket servers as part of their serverless function offering so I doubt you'll be able to use the Vercel adapter.

Could you elaborate on this? I was under the impression that this example app was a server and could be hosted directly on Vercel. I'm not sure I understand how a SvelteKit app can even be a serverless function. I'm not sure if there's some sort of requirement I'm missing..

@robotpapier
Copy link
Author

@aeviou
Yeah, as @suhaildawood said, and as in the Vercel docs, Vercel doesn't allow websockets connections, so there is no way It can work even if you can deploy it.
Luckily for my project, my apps will run locally in production, so I didn't try it on Cloudfare yet with which it should theorically work.
Hope it's clearer!

@aeviou
Copy link

aeviou commented Aug 20, 2023

Ah yes. My misunderstanding was that I didn't understand that Vercel deployed the SvelteKit app as a single serverless function. Thanks for the clarification!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants