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

fix: cors and sse for logs #1284

Conversation

frechg
Copy link
Contributor

@frechg frechg commented Oct 16, 2024

  • Updates local-interchain Docker to provide ssl certificates allowing testnet config json to be loaded remotely
  • Fixes logs server CORS errors
  • Fixes Server Sent Events formatting errors

@frechg frechg requested a review from a team as a code owner October 16, 2024 23:28
@frechg frechg requested review from joelsmith-2019 and removed request for a team October 16, 2024 23:28
Copy link

vercel bot commented Oct 16, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
interchaintest-docs ⬜️ Ignored (Inspect) Visit Preview Oct 17, 2024 5:25pm

@Reecepbcups Reecepbcups changed the title Galen/fix cors and sse for logs fix: cors and sse for logs Oct 16, 2024
@@ -79,7 +79,7 @@ func (ls *LogStream) StreamLogs(w http.ResponseWriter, r *http.Request) {
line, err := reader.ReadString('\n')
if err == nil {
// Send the log line to the client
fmt.Fprintf(w, "%s\n", line)
fmt.Fprintf(w, "data: %s\n\n", line)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

assume this is for pretty parsing client side?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, the data key and double new line at the end is proper server sent event format. You can get the event stream and manually handle it, but it won't work with the EventSource interface if it's not in that format. https://developer.mozilla.org/en-US/docs/Web/API/EventSource

@Reecepbcups Reecepbcups merged commit 94f22e6 into strangelove-ventures:reece/local-ic-stream-logs Oct 17, 2024
11 of 13 checks passed
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

Successfully merging this pull request may close these issues.

2 participants