question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Deployement error Using next translate

See original GitHub issue

Hi there, I am having issues when I try to deploy my app using next translate. Error message is related to an array of data fetched from locales files. It work perfectly in on localhost but when I am trying to deploy it. Getting map is not function.

Does anyone have clue of how it can be fixed? Should i use getstaticprop on the page to fix this?

import Image from "next/image";
import { AiOutlinePlus, AiOutlineMinus } from "react-icons/ai";
import { useState, useEffect } from "react";
import useTranslation from "next-translate/useTranslation";
import { Contact } from "../../components/contact/Contact";

const Conciergerie = () => {
  let { t, i18n, ready } = useTranslation("conciergerie", {
    useSuspense: true,
  });

  const scrollToConciergerie = () => {
    window.scrollTo({
      top: 300,
      behavior: "smooth",
    });
  };

  const myLoader = ({ src, width, quality }) => {
    return `${src}?w=${width}&q=${quality || 75}`;
  };

  const [showform, setshowform] = useState(false);

  useEffect(() => {
    window.addEventListener("load", scrollToConciergerie);
    return () => {
      window.removeEventListener("load", scrollToConciergerie);
    };
  });

  const showContactForm = () => {
    return <Contact />;
  };

  const contentData = t(
    "conciergerieData",
    { count: 1 },
    {
      returnObjects: true,
    }
  );

  return (
    <div className="section" onLoad={scrollToConciergerie}>
      <div className="container">
        <div className="text-center">
          <h1 className=" my-4 text-capitalize" id="conciergerie">
            {t("conciergerieHeader")}
          </h1>
        </div>
        <h3 className="text-capitalize concierge-subheading mt-3">
          {t("conciergerieTitle")}
        </h3>
        <p className="lead concierge-subheading-text">
          {t("conciergerieText")}
        </p>
      </div>
      <div className="container">
        <div className="row text-center mt-5">
          {contentData?.map((item) => {
            return (
              <div className="col-md-4" key={item.id}>
                <span className="fa-stack fa-4x">
                  <Image
                    layout="fill"
                    src={item.icon}
                    alt=""
                    className="svg-inline--fa fa-solid  fa-stack-1x fa-inverse"
                    aria-hidden="true"
                    focusable="false"
                    data-prefix="fas"
                    data-icon="house"
                    role="img"
                    loader={myLoader}
                  />
                </span>
                <h4 className="my-3 text-hogar2 text-uppercase">
                  {item.title}
                </h4>
                <ul>
                  {item.text.map((text) => {
                    return (
                      <li key={text.id} className="list-unstyled">
                        <p className="m-0 text-muted text-list">
                          {text.content}
                        </p>
                      </li>
                    );
                  })}
                </ul>

                {item.id === "algomas" &&
                  (!showform ? (
                    <AiOutlinePlus
                      role="button"
                      onClick={() => {
                        setshowform(!showform);
                      }}
                      className="fs-2"
                      fill="#5ab4ab"
                    />
                  ) : (
                    <AiOutlineMinus
                      role="button"
                      onClick={() => {
                        setshowform(!showform);
                      }}
                      className="fs-2"
                      fill="#5ab4ab"
                    />
                  ))}
                {item.id === "else" &&
                  (!showform ? (
                    <AiOutlinePlus
                      role="button"
                      onClick={() => {
                        setshowform(!showform);
                      }}
                      className="fs-2"
                      fill="#5ab4ab"
                    />
                  ) : (
                    <AiOutlineMinus
                      role="button"
                      onClick={() => {
                        setshowform(!showform);
                      }}
                      className="fs-2"
                      fill="#5ab4ab"
                    />
                  ))}
              </div>
            );
          })}
        </div>
        {showform && showContactForm()}
      </div>
    </div>
  );
};

export default Conciergerie;

image

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:25 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
Leonardllcommented, Jul 6, 2022

Hi Aralroca, thanks for answering. I am not using next export in my script. the repo is public on my profile. It’s name is unicohogar. 😊

0reactions
Leonardllcommented, Jul 11, 2022

Hi @aralroca , have you found any further information on this issue, please. ?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Deploy on production with next-translate · Issue #476 - GitHub
I have a simple Nextjs app which use next-translate and I'm struggling to deploy it. ... If i do so, I get an...
Read more >
vercel - How to fix next.js build prerendered error when using ...
i am having issues deploying on vercel. The build error is as per the screenshot below. deploy error screenshot.
Read more >
Common Errors with Exporting and Importing Translation Files
This error message only applies to data translation files. Data translation isn't enabled or was disabled after the data translation file was exported....
Read more >
next-translate - npm
Next-translate ensures that each page only has its namespaces with the current language. So if we have 100 locales, only 1 will be...
Read more >
Static HTML Export with i18n compatibility in Next.js - locize
This happens if you're using the internationalized routing feature and are trying to generate a static HTML export by executing next export ....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found