Urgent.News

What's breaking now, across thousands of outlets.

Tech

In Next.js 16, the return value of require.resolve becomes an integer and the code crashes

Summary I added one tool, which AI agents call from outside, to a service I develop at my own company. When this tool is called, one page selected from a PDF document stored in the service is converted into a JPEG image and included in the response as an image. Before deploying, the AI in charge of development had passed the type check and every unit test. It had also called the tool's function…

In the production build of Next.js 16, the require.resolve function returns an integer instead of a file location, causing a TypeError. This change does not trigger type checking, unit tests, or direct calls, so they cannot detect the issue. The problem occurs when the base for resolving the package location is set to the process's working directory instead of the package directory.

To fix the code, either use the working directory as the base or add a turbopackIgnore annotation. The failure happens right after deployment, and a check starting the same build as production and calling it from outside can help prevent future issues.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

Diagnose Android APK Installation Failures with ADB

An Android installer dialog often reduces a useful technical failure to two words: App not installed . That message can represent incompatible CPU architecture, a signature conflict, a lower version…

  • Confirm ADB recognizes correct device with adb devices -l
  • Examine APK details using aapt or apkanalyzer before installation
  • Compare APK package info with device specifications

More from Tuesday 29 September →