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

330
Views
Next JS _middleware does not allow use of dynamic evaluation 'new Function'

I am creating a _middleware.ts file for my next js app in order to provide dynamic redirects from data stored on Nacelle. I was successful on localhost, but when deploying to vercel, the build crashed due to "Dynamic Code Evaluation (e. g. 'eval', 'new Function') not allowed in Middleware pages/_middleware".

The reason being, inside _middleware I am including a file which creates an api client as so, but this is not allowed as stated in the next js docs.

    export default new NacelleClient({
        id: ex,
        token: ex,
        endpoint: ex,
    })

I am fairly new to next js and react so I am not very familiar with getServerSideProps or getStaticPaths. Can anyone inform me how I can successfully do this? If I need to use serverSideProps or getStaticPaths, how can I make the request, obtain the data, and pass it to _middleware? Thank you for any input and time, it is much appreciated.

about 4 years ago · Santiago Gelvez
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!