Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

339
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda