I encountered a MISSING_MESSAGE error while using the next-intl npm package in my next.js application

import { useEffect } from "react";
import type { AppProps } from "next/app";
import Script from "next/script";
import { SWRConfig } from "swr";
import { useRouter } from "next/router"
import { AppContext } from "@context/index";
import { NextIntlProvider } from 'next-intl'

function MyApp({ Component, pageProps }: AppProps) {

<SWRConfig
      value={{
        onErrorRetry: (error: any) => {
          // Never retry on 401.
          if (error.status === 401) return;
        },
        errorRetryCount: 2,
      }}
    >
    <>
      <NextIntlProvider messages={pageProps.messages}>
        <AppContext>
          <div>
          
            <Component {...pageProps} />
        
          </div>
        </AppContext>
        </NextIntlProvider>
      
      </>
    </SWRConfig>
 );
}

export default MyApp;

I encountered the 'MISSING_MESSAGE' error with the originalMessage stating 'No messages were configured on the provider,' despite following the documentation for Next-intl. I have confirmed that the message is configured in the _app.tsx file within the page folder. Can anyone offer guidance on resolving this issue?

Answer №2

In my experience, I encountered a similar issue where I was facing difficulties with rendering translated messages from the _app.tsx file in a navbar within Next.js. Ultimately, it turned out that the error was originating from the default error handlers (404 and 500) due to how Next.js handles these translations. To resolve this issue, I ended up creating custom error pages and loading the translations using the getStaticProps method.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Enhance accessibility in Next.js and React Bootstrap with a feature that allows users to easily customize the font

My goal is to develop a component that enhances accessibility by allowing users to change settings such as dark mode, higher contrast, and font size dynamically. Currently, I have created a bootstrap modal component where users can modify accessibility se ...

NGRX Store: Unable to modify the immutable property '18' of the object '[object Array]'

While attempting to set up an ngrx store, I encountered 7 errors. Error Messages: TypeError: Cannot assign to read only property '18' of object '[object Array]' | TypeError: Cannot assign to read only property 'incompleteFirstPass ...

"Discover the step-by-step process of building a vue.js3 application with typescript, vue-router, and vuex without relying on

I have been assigned the task of developing a Vue3 application with TypeScript support using Vuex for state management and vue-router for basic routing. However, I am not allowed to use vue-cli for this project. Here is my current code: <head> & ...

Angular 6: The Promise<any> is incompatible with the LeagueTable type

Recently delving into Angular and attempting to retrieve JSON League Table data from the API, I encountered an error message stating Type 'Promise' is not assignable to type 'LeagueTable'. leaguetable.service.ts import { Injectable } ...

What is the reasoning behind ethers.js choosing to have the return value of a function be an array that contains the value, rather than just the value itself

An issue arose with the test case below: it('should access MAX_COUNT', async () => { const maxCount = await myContract.functions.MAX_COUNT(); expect(maxCount).to.equal(64); }); The test failed with this error message: ...

Error: Unable to inject HttpClient dependency. Angular 5

I recently switched to using the Angular template in Visual Studio 2017 and decided to update to Angular 5.2. However, I encountered an error while trying to make a http call from the service class. The error message I received is: https://i.sstatic.net/p ...

What is the best way to inspect the state of a Next.js component?

I am integrating the react-placeholder package into my component and it specifies that the ready parameter should be set to this.state.ready. What is the equivalent of this in NextJS? After attempting to console.log(this) in my component, I only receive & ...

Inter-component communication within nested structures in Angular 2

Working on an Angular2 project that involves multiple nested components, I have successfully sent data from a child component to its immediate parent. However, when dealing with three levels of nesting, the question arises: How can I send or modify data ac ...

Tips for showcasing with [displayWith] in Material2's AutoComplete feature

My API returns an array and I am using Material2#AutoComplete to filter it. While it is working, I am facing an issue where I need to display a different property instead of the currently binded value in the option element. I understand that I need to uti ...

click event on ion card

Attempting to handle a click event within an ion-card using Ionic 5.0.2 version has presented some challenges. Despite my efforts, I have not been successful in handling the event with the expected function. Here is a snippet of my code: Dynamic card list ...

Is it possible for the binding model of Mat-Checkbox to be optional or null?

Greetings everyone! I am a newcomer to the world of Angular, where I have successfully created a dynamic list of checkboxes. However, I have encountered a challenge when trying to bind selected values from an API to these checkboxes. <div *ngFor="let b ...

Next.js shallow routing is not functioning as expected when a query string is added

The issue at hand: When attempting shallow routing in Next.js by changing the query string (adding or removing, but not updating), the page is reloaded and the shallow option is ignored. Is there a way to prevent reloading while modifying the query strin ...

Is it possible to create a TypeScript class that contains various custom functions?

Exploring TypeScript is a fresh yet exciting journey for me! In the world of JavaScript, checking if an object has a function and then calling it can be achieved with code like this: if(this['my_func']) { this['my_func'](); } Howeve ...

Using Node.js with Typescript and RedisJSON allows for a powerful and efficient

I've recently started delving into nodejs, typescript, and redis for programming. However, I've encountered an issue with redis: when defining a data interface to be stored in redis, the system throws errors as soon as I try to specify the data t ...

Updating the state in a different component using React and Typescript

The Stackblitz example can be found here I'm attempting to update the useState in one component from another component. Although it seems to work here, it's not functioning properly in my actual application. Here is a snippet of the app.tsx co ...

Why does the behavior of creating relative URLs with `new URL()` change when the first parameter is a variable?

Recently, I've been diving into the world of web workers in NextJs. I tried to follow their example, but ran into an issue that's been bugging me. It seems that passing the worker relative URL as a variable to new URL(url, baseUrl) isn't wor ...

Obtain a tuple of identical length from a function

I'm attempting to create a function that returns a tuple with the same length as the parameter tuple passed to it. Although I tried using generics, I am encountering an error when applying the spread operator on the result. My goal is best illustrate ...

Having trouble configuring Jest for TypeScript integration

I am currently implementing unit testing for a typescript project following the guidelines in this example: https://dev.to/muhajirdev/unit-testing-with-typescript-and-jest-2gln In my project, I have a file named main.ts that exports an isInternalLink func ...

Troubleshoot TypeScript API within Angular 12 using Chrome debugger

I'm having trouble finding a solution on SO. Can anyone help me debug and check the code snippet below for hello? getHero(): void { const id = parseInt(this.route.snapshot.paramMap.get('id') !, 10); this.heroService.getHero(id) .sub ...

TypeScript React Object.assign method return type

I have a unique custom function that utilizes Object.assign to return a specific result. The documentation mentions that this function returns an array, but surprisingly, it can be destructured both as an array and an object. Check out the code snippet be ...