Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

190
Visualizações
ServerRuntimeConfig is empty

I am working on my nextjs project under docker, and when using getStaticProps my backend api is not available(which is also under docker). So I connected frontend to backend via networks and if i hardcode api for ssr request it works. But when i try to utilize serverRuntimeConfig and publicRuntimeConfig so i could switch between them depending on where code is being ran I get {} for serverRuntimeConfig. However publicRuntimeConfig is fine and i can access api from it. My next.config.js is:

module.exports = {
    publicRuntimeConfig: {
        // Will be available on both server and client
        baseUrl: 'http://localhost/api/v1',
    },
    serverRuntimeConfig: {
        // Will only be available on the server side
        baseUrl: 'http://backend_nginx_1/api/v1/',
    },

am I missing something ?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

This will sound dumb, but I spent 2 hours seeing the empty file been recognized by the system and just seeing {}. Now... restarting the server, gives you access to the content of the file. That was my solution.

And it was not included in the documentation.

https://nextjs.org/docs/api-reference/next.config.js/runtime-configuration

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda