Thanks for following up. Echoing @hrishikesh, what does the error in the Functions’ console say? This will be beneficial for us to further understand the problem.
Additionally, I see you shared the site above. Thanks! What are the reproduction steps so that we can see what you are seeing? Please let us know!
Not sure what you mean by Functions’ console nor reproduction steps
This is my output in console
gr Response
App.svelte:20 error SyntaxError: Unexpected token l in JSON at position 0
bundle.css:1 Failed to load resource: the server responded with a status of 404 (Not Found)
and this in terminal
LOGS
[10:10:16] 200 ─ 6.61ms ─ /
┌─────────────────────────────────────────────────┐
│ │
│ ◈ Server now ready on http://localhost:8888 │
│ │
└─────────────────────────────────────────────────┘
[10:10:17] 200 ─ 1.32ms ─ /
[10:10:17] 404 ─ 0.91ms ─ /build/bundle.css
[10:10:17] 200 ─ 5.35ms ─ /global.css
[10:10:17] 200 ─ 6.62ms ─ /build/bundle.js
Request from ::1: GET /.netlify/functions/database-streams
◈ lambda response was undefined. check your function code again
Response with status 500 in 171 ms.
[10:10:22] 200 ─ 4.06ms ─ /global.css
[10:10:22] 404 ─ 0.50ms ─ /build/bundle.css
[10:10:23] 200 ─ 4.86ms ─ /build/bundle.js.map
Is this the port you have configured netlify dev to run on instead of the default 8888? Or is this the port the functions server is listening on? Or is this the port LiveReload is running on?
this is only the return for startStream, not for the function as a whole. You code needs to look something like this fetch example from the Functions Playground.
What what I have read about Fauna DB streams (and please correct me if I’m wrong as I haven’t spent much time using Fauna) is it opens, and keeps open, a connection. This is going to last 10 seconds only as that is as long as serverless function will run (with a maximum of 26 seconds when upgraded.)
My use-case is that I want to notify the user when a change is made to the database. Fauna provides this on the client side as you say. But if Netlify only holds the function open for 10 secs that is a problem. Any suggestions for a way forward?