Skip to content

Silent timeouts during image generation #367

@rovo89

Description

@rovo89

In our Next.js app, I noticed that replicate.stream() sometimes/often doesn't produce any events, although the web console shows that they were successfully generated. This seems to happen when the image takes longer than 60 seconds to generate. I see that fetch() receives the response headers, but then the stream closes before the response is received.

Just guessing - does Cloudfare see this as an idle connection and terminates it after a 60 second timeout? In that case, the library wouldn't be able to solve it, but the server would need to send a "ping" every 10 seconds or so to keep the connection alive.

But maybe you have other ideas? Would it make sense to detect that no "done" event was sent and just retry fetching the URL? When I manually opened the streaming URL in the browser after the connection was closed, they immediately showed the picture.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions