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

177
Views
NextJS getStaticProps / getStaticPaths typeError: response is not a function

I'm struggling with an error showing up in my terminal when testing on localhost. I've been getting an inconsistent message reading:

error - TypeError: response is not a function

I'm having trouble figuring out why it happens, because it only shows up on maybe 1 out of 10 refreshes of the page, and there are no useful messages in the browser console. I don't even know if the problem is triggered by getStaticPaths or getStaticProps, because I can't include one without the other.

Anyone see what I'm missing? I've simplified the code to this:

const Reviews = props => {
    console.log("Reviews rendering");
    return (
        <Fragment>word</Fragment>
    );
};
 export async function getStaticPaths() {
      let config = await import("../../config/config");
      let axResponse = await axios.get(`https://${config.default.domain}/api/get/ti.php`);
      return {
            paths: axResponse.data.items.map(item=>({ params: { code: item } })),
            fallback: true
      };
 };
 export async function getStaticProps(context) {
      let config = await import("../../config/config");
      let axResponse = await axios.get(`${config.default.apiEndpoint_static}&sft=reviews&code=${context.params.code}`);
      return {
            props: {
                 asdf: "zxcv"
            }
      };
 };

The import of config is just a local json file that has stuff like the api endpoint, domain name, etc. I have a feeling this might be what NextJS doesn't like, but I'm not sure. It does work though.

I've also verified that the responses from the api are valid json with the expected data. Basically, getStaticPaths is pulling a list of top items so that only those items will be pre-rendered on the server, and getStaticProps is pulling reviews for each item so that they can be displayed. I'm purposely not doing anything with the reviews in this simplified demo, I just wanted to leave the line there in case it's part of the problem.

And here's a longer snippet from the terminal. Every "Reviews rendering" line is me hitting refresh on the browser. Maybe the fact that it only seems to happen after I've changed the file is meaningful.. Further refreshes don't seem to trigger the message.

event - compiled successfully in 973 ms (1974 modules)
Reviews rendering
error - TypeError: response is not a function
wait - compiling /_error...
event - compiled successfully in 937 ms (1974 modules)
Reviews rendering
Reviews rendering
Reviews rendering

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!