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

338
Visualizações
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 à 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