-
Verify canary release
Provide environment informationnpm. 8.5.5 What browser are you using? (if relevant)Safari & Brave How are you deploying your application? (if relevant)N/A Describe the BugThe bug seems to be that the function server-side translations is in conflict with another function called getServerSideProps, and there is a conflict because I cannot have two server functions in one file. Expected BehaviorYou must provide a clear and concise description of what you expected to happen. To Reproduce |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
|
@lertsoft You cannot use getStaticProps and getServerSideProps on the same page. Since you likely want to server-side render the page (it is fetching some github data that you probably want to be updated every so often), merge the translations code into the import getLatestRepos from "@lib/getLatestRepos";
import userData from "@constants/data";
import { serverSideTranslations } from 'next-i18next/serverSideTranslations'
export default function Home({ repositories }) {
return (
<ContainerBlock
title="Developer, Photographer, Filmmaker, Creator"
description="This is a website build to learn more of the tailwind css and next.js" >
<Hero />
<FavouriteProjects />
<LatestCode repositories={repositories} />
</ContainerBlock>
);
}
export const getServerSideProps = async ({ locale }) => {
console.log(process.env.GITHUB_AUTH_TOKEN);
let token = process.env.GITHUB_AUTH_TOKEN;
const repositories = await getLatestRepos(userData, token);
// console.log("REPOSITORIES", repositories);
return {
props: {
repositories,
...await serverSideTranslations(locale, ['common', 'footer']),
},
};
};This will do the translations on every request, so this may not be the exact behavior you want, however. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
|
I am going to close this disccusion as I found my culprit for the error.
TLDR;
|
Beta Was this translation helpful? Give feedback.
-
|
Sorry for bumping and potentially spamming with notification, but I just wanted to leave a helpful comment for people googling the issue: Rarely with next.js in dev mode when you rename/move your files something goes wrong with some cache [?] and this error message appear for no reason, in a route that clearly not uses any of |
Beta Was this translation helpful? Give feedback.


I am going to close this disccusion as I found my culprit for the error.
As I was trying to find solutions I had put these code on my next.config.js file, also had I had a component that was getting information from a remote server and every time that the server fetched data it would create a conflict with the translation as that was constant.
webpackFinal: async (config, { configType }) => { // config.resolve.fallback = { // ...config.resolve.fallback, // fs: false, // <------ // path: false // <----- // }; // return config; // },TLDR;