xmtp / xmtp-js

XMTP client SDKs for JavaScript applications.

Home Page:https://xmtp.org/docs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Console filled with CORS errors

fabriguespe opened this issue · comments

commented

Description

The application encounters a Stream connection closed. Resubscribing TypeError: Failed to fetch error after a period of idle activity. This error seems to be related to CORS policy, specifically the absence of the 'Access-Control-Allow-Origin' header on a requested resource from 'https://dev.xmtp.network/message/v1/subscribe'. The error causes an unwanted log output that appears intermittently after some minutes of idle activity.

The full error message is as follows:
javascript Copy code Stream connection closed. Resubscribing TypeError: Failed to fetch inbox:1 Access to fetch at 'https://dev.xmtp.network/message/v1/subscribe' from origin 'https://dev.xmtp.chat' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled. _app-a3d1fbcef7da14c9.js:25 POST https://dev.xmtp.network/message/v1/subscribe net::ERR_FAILED 502 ... TypeError: Failed to fetch

Expected Behavior

In the idle state, the application should not generate any log output related to network changes or errors. As such, this CORS-related error message should not appear.

Steps to Reproduce

This error occurs after some minutes of idle activity in both development and production environments. The error log appears periodically at seemingly arbitrary intervals.

Relevant conversation threads regarding this issue can be found here:

Slack Conversation: https://xmtp-labs.slack.com/archives/C02BABHFZG9/p1685465049777349
Discord Conversation: https://discord.com/channels/831836269558235136/1113936882095620176

Additional Information
The occurrence of this error does not seem to depend on any specific user action or scenario but rather appears during idle activity.

@fabriguespe this is with xmtp-js, correct?

@fabriguespe do you have an easy way to reproduce this? I'm not seeing it on dev.xmtp.chat.

this is likely a rate limiting error. please reopen if you think otherwise.