cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Generative AI
Explore discussions on generative artificial intelligence techniques and applications within the Databricks Community. Share ideas, challenges, and breakthroughs in this cutting-edge field.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Databricks Apps Streaming issue

the_peterlandis
New Contributor III

I have .NextJS Databricks Apps with streaming enabled by setting "stream:true" in the JSON body which tells serve to return a streaming response (SSE format).  Now this works just fine when I run the app locally via npm run dev but once I deploy the app via Databricks Apps, streaming is not longer available.  It waits until the whole response is done and then displays the whole response all at once.  It appears that Databrics App has a proxy that is preventing streaming when stream:true is set.

1 ACCEPTED SOLUTION

Accepted Solutions

the_peterlandis
New Contributor III

What resolved this issue is to set the following headers listed below.  

Content-Type: "text/event-stream"
Connection: "keep-alive"
Transfer-Encoding: "chunked"

These headers help prevent proxy interference:

  • Connection: "keep-alive" explicitly tells proxies not to close the connection, preventing premature termination
  • Transfer-Encoding: "chunked" signals the proxy that variable-length chunks are normal, not an error
  • Content-Type: "text/event-stream" hints to the proxy this is streaming data, deserving special handling

View solution in original post

1 REPLY 1

the_peterlandis
New Contributor III

What resolved this issue is to set the following headers listed below.  

Content-Type: "text/event-stream"
Connection: "keep-alive"
Transfer-Encoding: "chunked"

These headers help prevent proxy interference:

  • Connection: "keep-alive" explicitly tells proxies not to close the connection, preventing premature termination
  • Transfer-Encoding: "chunked" signals the proxy that variable-length chunks are normal, not an error
  • Content-Type: "text/event-stream" hints to the proxy this is streaming data, deserving special handling