razshare / sveltekit-sse

Server Sent Events with SvelteKit
https://www.npmjs.com/package/sveltekit-sse
MIT License
274 stars 9 forks source link

problem when deploying in vercel #51

Closed aristelecom closed 2 months ago

aristelecom commented 2 months ago

Hi, I am using https://github.com/razshare/sveltekit-sse

and I can't get it to work in vercel, It works for about 10 seconds and then stops working.

Everything would indicate that the problem is due to the limitations that vercel has by being serverless as indicated in this conversation.

https://stackoverflow.com/questions/76204143/sse-works-locally-but-not-when-deployed-to-vercel

Although it is indicated as a solution to use the edge runtime when making the configurations, the problem persists and only works for 10s,

use this template for edge runtime implementation

https://vercel.com/templates/svelte/sveltekit-edge-functions

but when performing the deployment receipt the following error

You cannot use "streaming" when deploying to Vercel Edge Functions.

razshare commented 2 months ago

Hello @aristelecom , First of all, thank you for the feedback.

Second, I'm not very familiar with the internals of vercel functions.\ However, judging from that message it doesn't seem like something I can fix from this library's side.\ The library is not doing anything special in the background, it's only using standard js readable streams to stream events.

That being said, I just tried to deploy an application to vercel using sveltekit-sse and it works fine, it doesn't stop after 10 seconds like in your case.

Here's the repo I deployed to vercel in my test https://github.com/razshare/sveltekit-sse-issue-51, you can try deploying that and see if you're still getting that error.\ If the error persists, my hunch is the problem is within your vercel dashboard or something like that.

I'm willing to give it a try and take a look at the issue in more depth, but I need you to create a repository that reproduces the error as you see it, otherwise I can't help you.

aristelecom commented 2 months ago

Hello @aristelecom , First of all, thank you for the feedback.

Second, I'm not very familiar with the internals of vercel functions. However, judging from that message it doesn't seem like something I can fix from this library's side. The library is not doing anything special in the background, it's only using standard js readable streams to stream events.

That being said, I just tried to deploy an application to vercel using sveltekit-sse and it works fine, it doesn't stop after 10 seconds like in your case.

Here's the repo I deployed to vercel in my test https://github.com/razshare/sveltekit-sse-issue-51, you can try deploying that and see if you're still getting that error. If the error persists, my hunch is the problem is within your vercel dashboard or something like that.

I'm willing to give it a try and take a look at the issue in more depth, but I need you to create a repository that reproduces the error as you see it, otherwise I can't help you.

Hello, thanks for responding, it seems the problem I am experiencing is due to a limitation of your platform and not a problem with the library as you indicated above,

make the same query in the svelte discord attached the link: https://discord.com/channels/457912077277855764/1257434497268449340

According to the comments, it is not possible to solve the problem given the limitations of vercel, so I think I will have to use another service,

I'll try cloudfalre pages although I suspect I'm going to face the same problem.

An alternative solution might be to continue hosting my page on vercel and host the ss e function on some service like render.

also and entered link: https://sveltekit-sse-issue-51.vercel.app/ of the repo you attached and it presents this error

image

razshare commented 2 months ago

also and entered link: https://sveltekit-sse-issue-51.vercel.app/ of the repo you attached and it presents this error

I should've clarified, that link is no longer available. I deployed the app, did some tests and then destroyed the vercel app. If you want to test it yourself you need to take that code and deploy it yourself.

The link is just added automatically by vercel I think, I forgot to remove it.

According to the comments, it is not possible to solve the problem given the limitations of vercel, so I think I will have to use another service,

If it's any help, other people have deployed it with success to cloudflare.

razshare commented 2 months ago

Also, I've recently added this section to the readme, you might find it interesting, the second point at least https://github.com/razshare/sveltekit-sse?tab=readme-ov-file#faq