openedx / openedx/frontend-template-application
ErrorPage fails on getLocale() because i18n isn't initialized.
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 38
- Forks
- 67
- Avg merge
- 34m
- Merged PRs (30d)
- 2
Description
Description:
Some (maybe all?) MFEs have issues with ErrorPages and i18n.
The ErrorPage is invoked before either the Locale is set or Intl is initialized as a whole.
This should likely later be remediated in any MFEs that have this issue.
Repro Steps
- Up devstack (im from REV so, we tend to grab
lms+redis+ecommerce) - Once up, start Payment MFE (we dont use docker for this as there is an issue with the image we have yet to fix, its alo not germaine)
npm ci && npm start - Stop LMS
- Open Payment MFE in a Browser http://localhost:1998/
Technical/Additional Details
Specific Error: getLocale called before configuring i18n. Call configure with messages first.
Stack Trace:
Call Stack
getLocale
node_modules/@edx/frontend-platform/i18n/lib.js:273:11
ErrorPage
node_modules/@edx/frontend-platform/react/ErrorPage.js:82:115
renderWithHooks
node_modules/react-dom/cjs/react-dom.development.js:14803:18
mountIndeterminateComponent
node_modules/react-dom/cjs/react-dom.development.js:17482:13
beginWork
node_modules/react-dom/cjs/react-dom.development.js:18596:16
HTMLUnknownElement.callCallback
node_modules/react-dom/cjs/react-dom.development.js:188:14
Object.invokeGuardedCallbackDev
node_modules/react-dom/cjs/react-dom.development.js:237:16
invokeGuardedCallback
node_modules/react-dom/cjs/react-dom.development.js:292:31
beginWork$1
node_modules/react-dom/cjs/react-dom.development.js:23203:7
performUnitOfWork
node_modules/react-dom/cjs/react-dom.development.js:22154:12
Code Ptr (ErrorPage initialization point): https://github.com/openedx/frontend-template-application/blob/master/src/index.jsx#L28
Community Example (learner MFE): https://discuss.openedx.org/t/when-attempting-to-enter-a-courses-home-on-learning-mfe-error-getlocale-called-before-configuring-i18n/9756/1
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at src/index.jsx, especially the ErrorPage initialization point, then inspect ErrorPage.js and the getLocale call in @edx/frontend-platform/i18n/lib.js. Reproduce the failure by stopping LMS and opening the Payment MFE at http://localhost:1998/. Done means ErrorPage no longer fails when i18n has not yet been configured.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend, internationalization
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100