You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm getting the following CORS issue when attempting to run the countly-sdk-web with Next.js. The error I receive is:
Access to XMLHttpRequest at 'https://countly.doc.ai/i?begin_session=1&metrics=%7B%22_app_version%22%3A%220.0%22%2C%22_ua%22%3A%22Mozilla%2F5.0%20(Macintosh%3B%20Intel%20Mac%20OS%20X%2010_15_7)%20AppleWebKit%2F537.36%20(KHTML%2C%20like%20Gecko)%20Chrome%2F86.0.4240.111%20Safari%2F537.36%22%2C%22_resolution%22%3A%222560x1440%22%2C%22_density%22%3A2%2C%22_locale%22%3A%22en-US%22%7D&app_key=ad952f815d0d64be3fa7c5a39692e7833959e449&device_id=60997e91-16a7-4981-a907-d50e1700b34d&sdk_name=javascript_native_web&sdk_version=20.04×tamp=1603830178200&hour=13&dow=2' from origin 'http://localhost:9000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
Here is the script I'm running in my _app.jsx:
<script
type="text/javascript"
dangerouslySetInnerHTML={{
__html: `
Countly.init({
// provide your app key that you retrieved from Countly dashboard
app_key: {app_key_here},
// Provide your server IP or name. Use try.count.ly or us-try.count.ly
// or asia-try.count.ly for EE trial server.
// If you use your own server, make sure you have https enabled if you use
// https below.
url: {url}
});
// track sessions automatically
Countly.track_sessions();
// track pageviews automatically
Countly.track_pageview();
`,
}}
/>
Hello,
I think this is problem on Countly server, not your server
please make sure you have Access-Control-Allow-Origin: * or other origin control setup in
Countly dashboard -> top cog -> Configurations -> Security -> Additional API HTTP Response headers
I'm getting the following CORS issue when attempting to run the
countly-sdk-web
with Next.js. The error I receive is:Here is the script I'm running in my
_app.jsx
:I've tried enabling https://expressjs.com/en/resources/middleware/cors.html middleware in my Next.js app, but I still receive the same error.
Any chance my setup is incorrect?
Thanks for looking into this.
The text was updated successfully, but these errors were encountered: