Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

201
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!