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

203
Visualizações
Unable to use Storyblok API when Real Path is defined

I am working on a website using Next.js (SSR) and Storyblok (Headless CMS) and using the Storyblok Content Delivery API to fetch the content from Storyblok. Originally, it was using the SSG method to look over the available links, and then generating the pages from there, which is how the majority of the Next/ StoryBlok tutorials show you how, However, I needed to utilise the SSR method.

I have a page which has a default slug of pages/industries and then within the getServerSideProps method, I am looking for the slug from the passed context param. If the page is not being used in the Preview Mode then it will use the query.slug data to build the paths to use in the StoryBlok JS client package (await Storyblok.get(url, sbParams);)

However, when the real_path has been configured to another value (/industry) the query.slug or the resolved_path is updated to the real path value. Which when querying the API, it 404s, because the actual route is still at pages/industries and this original value is not in the context of the getServerSideProps param.

One solution I thought would be to query all of the available links using cdn/links and compare the slug vs the real_path then get the Story ID based on that comparison but this doesn't seem right (currently trying to make this work and scale at the moment).

This isn't an issue in the preview mode as the request passes me the Story ID, so it is easy to query the API.

This is the response from viewing the page, not in preview mode and you can see the values.

 query: { 
  slug: [ 'industry' ] },
  resolvedUrl: '/industry',
  params: { slug: [ 'industry' ] },
  locales: undefined,
  locale: undefined,
  defaultLocale: undefined
}

How can I still get the original API link to query?

about 4 years ago · Juan Pablo Isaza
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