Next.js Discord

Discord Forum

Nextjs 16 issue with next.config

Unanswered
Transvaal lion posted this in #help-forum
Open in Discord
Transvaal lionOP
This is my next config file:
import type { NextConfig } from "next";
import { withPlausibleProxy } from "next-plausible";
import { withSentryConfig } from "@sentry/nextjs";
import path from "path";
import { nodeFileTrace } from "@vercel/nft";

async function getDrizzleFiles(): Promise<string[]> {
    const drizzle = await nodeFileTrace([require.resolve("drizzle-kit"), require.resolve("drizzle-orm"), path.resolve(path.dirname(require.resolve("drizzle-kit")), "bin.cjs")]);
    return [...drizzle.fileList, "./node_modules/.bin/drizzle-kit", "./node_modules/drizzle-orm/**", "./node_modules/drizzle-kit/**"];
}

async function nextConfig(): Promise<NextConfig> {
    const drizzleFiles = await getDrizzleFiles();
    return withSentryConfig(
        withPlausibleProxy({
            customDomain: "https://analytics.mytool.com",
        })({
            output: "standalone",
            outputFileTracingIncludes: {
                "**": drizzleFiles,
            },
        }),
        {
            tunnelRoute: "/monitor",
        }
    );
}

export default nextConfig;


Prior upgrading to next v16 it worked. Now on prod builds I get a 500 server error when i try to load the file from /js/script.file-downloads.hash.outbound-links.tagged-events.js

In next dev it correctly resolveshttp://localhost:3000/js/script.file-downloads.hash.outbound-links.tagged-events.js to https://analytics.mytool.com/js/script.file-downloads.hash.outbound-links.tagged-events.js

Please help

3 Replies

Transvaal lionOP
I added this:
const rewrites = await config.rewrites();
    const match = rewrites.find((r) => r.source === "/js/script.file-downloads.hash.outbound-links.tagged-events.js");

    console.log("MATCH FOR SCRIPT VARIANT:", match);


to my next config to test if it find a match:
 2025-Dec-10 20:13:10.767821 #14 1.253 $ next build --webpack 
#14 51.98 MATCH FOR SCRIPT VARIANT: {
2025-Dec-10 20:14:01.685490 #14 51.98   source: "/js/script.file-downloads.hash.outbound-links.tagged-events.js",
2025-Dec-10 20:14:01.685490 #14 51.98   destination: "https://analytics.mytool.com/js/plausible.file-downloads.hash.outbound-links.tagged-events.js",
2025-Dec-10 20:14:01.685490 #14 51.98 } 


so the route seems valid?

I also tried to curl it from within the container and was able to curl the url.

Its defenatly a problem from nextjs v16
Transvaal lionOP
?
Please help...