Learner Dashboard MFE Error After Login: “An unexpected error occurred. Please refresh the page.”

Hi everyone,

I’m running Open edX with Tutor and facing a problem with the Learner Dashboard MFE.
After users sign in through our LMS at:

https://learn.mysite.miu.edu.tr/

and then get redirected to the MFE at:

https://apps.mysite.miu.edu.tr/learner-dashboard

they see this error:

“An unexpected error occurred. Please click the button below to refresh the page.”

Details

Environment

  • Tutor version: 20.0.1

  • Using MFEs hosted at: apps.mysite.miu.edu.tr

  • LMS hosted at: learn.mysite.miu.edu.tr

  • OS: Ubuntu 24.04.3 LTS

I suspicious to CORS / cookies not being shared across domains.
Possibly a mismatch between:

  • JWT_AUTH,

  • SESSION_COOKIE_DOMAIN,

  • or CSRF_COOKIE_DOMAIN

In LMS container:

from django.conf import settings

print(“CSRF_COOKIE_DOMAIN:”, settings.CSRF_COOKIE_DOMAIN)
print(“CSRF_COOKIE_SAMESITE:”, settings.CSRF_COOKIE_SAMESITE)
print(“SESSION_COOKIE_DOMAIN:”, settings.SESSION_COOKIE_DOMAIN)
print(“SESSION_COOKIE_SAMESITE:”, settings.SESSION_COOKIE_SAMESITE)

I get:

  • CSRF_COOKIE_DOMAIN: None
  • CSRF_COOKIE_SAMESITE: Lax
  • SESSION_COOKIE_DOMAIN: learn.mysite.miu.edu.tr

SESSION_COOKIE_DOMAIN should be .mysite.miu.edu.tr not learn.mysite.miu.edu.tr

The ~/.local/share/tutor/config.yml includes:

APPS_DOMAIN: apps.mysite.miu.edu.tr
BASE_DOMAIN: mysite.miu.edu.tr
CMS_HOST: studio.mysite.miu.edu.tr
CMS_OAUTH2_SECRET: “key“
CMS_SITE_ID: 1
CMS_UWSGI_EXTRA_OPTIONS: --limit-post=1073741824 --harakiri=300 --socket-timeout=300
–http-timeout=300 --buffer-size=65535
CSRF_COOKIE_DOMAIN: .mysite.miu.edu.tr
CSRF_COOKIE_SAMESITE: None
CSRF_COOKIE_SECURE: true
EDX_JWT_COOKIE_DOMAIN: .mysite.miu.edu.tr
EDX_JWT_COOKIE_SAMESITE: None
EDX_JWT_COOKIE_SECURE: true
ENABLE_JWT_AUTH: true

MFE_CONFIG:
authn:
ACCOUNT_PROFILE_URL: https://apps.mysite.miu.edu.tr/account/profile
CSRF_TOKEN_API_URL: https://learn.mysite.miu.edu.tr/csrf/api/v1/token
ENABLE_ACCESSIBILITY_PAGE: true
LMS_BASE_URL: https://learn.mysite.miu.edu.tr
LOGIN_URL: https://learn.mysite.miu.edu.tr/login
LOGOUT_URL: https://learn.mysite.miu.edu.tr/logout
ORDER_HISTORY_URL: https://apps.mysite.miu.edu.tr/order-history
PRIVACY_POLICY_URL: https://learn.mysite.miu.edu.tr/privacy
REFRESH_ACCESS_TOKEN_ENDPOINT: https://learn.mysite.miu.edu.tr/login_refresh
SESSION_COOKIE_DOMAIN: .mysite.miu.edu.tr
TERMS_OF_SERVICE_URL: https://learn.mysite.miu.edu.tr/terms
learner-dashboard:
ACCOUNT_PROFILE_URL: https://apps.mysite.miu.edu.tr/account/profile
ACCOUNT_SETTINGS_URL: https://apps.mysite.miu.edu.tr/account
BASE_URL: https://apps.mysite.miu.edu.tr/learner-dashboard
CSRF_TOKEN_API_URL: https://learn.mysite.miu.edu.tr/csrf/api/v1/token
ENABLE_ACCESSIBILITY_PAGE: true
LMS_BASE_URL: https://learn.mysite.miu.edu.tr
LOGIN_URL: https://learn.mysite.miu.edu.tr/login
LOGOUT_URL: https://learn.mysite.miu.edu.tr/logout
ORDER_HISTORY_URL: https://apps.mysite.miu.edu.tr/order-history
PRIVACY_POLICY_URL: https://learn.mysite.miu.edu.tr/privacy
REFRESH_ACCESS_TOKEN_ENDPOINT: https://learn.mysite.miu.edu.tr/login_refresh
SESSION_COOKIE_DOMAIN: .mysite.miu.edu.tr
SITE_NAME: mysite
TERMS_OF_SERVICE_URL: https://learn.mysite.miu.edu.tr/terms

MFE_ENABLED: true
MFE_EXTRA_NPM_PACKAGES: ‘@openedx/frontend-plugin-framework’
MFE_HOST: apps.mysite.miu.edu.tr

PLUGINS:

THEME_NAME: miu

SESSION_COOKIE_DOMAIN: .mysite.miu.edu.tr
SESSION_COOKIE_SAMESITE: None
SESSION_COOKIE_SECURE: true

@arbrandes any advice here?

What the recent versions of Tutor would expect in your case is the LMS at learn.mysite.miu.edu.tr, and frontend apps at apps.learn.mysite.miu.edu.tr. Have you checked if that works?

I imagine that perhaps you’d like to avoid the longer domain name, but at the moment anything different is considered off the beaten path, and could be tricky to get working.