-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined #5478
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hey thanks for writing in. That looks like a problem we should fix. To help us debug, could you tell us your next + webpack version, and show us your |
Next 12.1.6 (the webpack version bundled with that)
|
Why are you using the sentry |
@AbhiPrasad trying this now, this is old code so a refactor is always appreciated. I'll let you know results here soon. |
I'm using withSentryConfig and facing the same issue as well |
@AbhiPrasad updated to the above and seems to be building now in production. Not sure what changed between today and yesterday (tried reverting back to 7.7.0 first to make sure and it also failed with same error). Could be that Next updated their 16.x node version which might have had some breaking changes potentially? |
@wadehammes - glad to hear it's working now! I can see what's failing (and will add a safety check around it), and indeed, there was a change released in 7.8.0 which touches that code path. The fact that it was still erroring when you reverted to 7.7.0 is very curious, though, and obv would mean the change in question wasn't the cause. When you did that, had you already made the @vip30 - Can you also please share your nextjs version and |
@lobsterkatie @AbhiPrasad the new |
I had not updated to the |
Maybe? Though I've never seen that happen, even when deploying slightly different versions of the SDK over and over again in rapid succession (as I did more times than I can count when building the SDK!). Might just be gremlins... As for the |
@lobsterkatie yes all assets are from Contentful's asset CDN. For example, https://www.gotrhythm.com/plans-overview |
That is indeed strange. And does this also happen with 7.7.0, or no? |
@lobsterkatie actually this is 7.7.0 right now, let me try 7.8.0 now |
That actually was 7.8.0 😅 sorry it's too late for me to be working |
Updated some CORS headers on my end in my next.config and seem to have resolved it. Looking forward to the patch above! |
Here is the nextjs config and yes 7.7.0 is working, just not working in 7.8.0 const path = require("path");
const relayConfig = require("./relay.config");
const WebpackAliyunOssPlugin = require("webpack-aliyun-oss");
const withInterceptStdout = require("next-intercept-stdout");
const withPWA = require("next-pwa");
const { withSentryConfig } = require("@sentry/nextjs");
// Get environment variables
const cdnHost = process.env.OSS_HOST;
const envSlug = process.env.ENV_SLUG;
const siteUrl = process.env.NEXT_PUBLIC_SITE_URL;
const useCDN = process.env.USE_CDN === "true";
const useSourceMap = process.env.USE_SOURCE_MAP === "true";
const oss = {
bucket: process.env.OSS_BUCKET_NAME || "",
keyId: process.env.OSS_ACCESS_KEY_ID || "",
keySecret: process.env.OSS_ACCESS_KEY_SECRET || "",
region: process.env.OSS_REGION || "",
};
/** @type {import('next').NextConfig} */
let nextConfig = {
assetPrefix: useCDN ? `https://${cdnHost}/${envSlug}` : "",
compiler: {
emotion: true,
relay: relayConfig,
reactRemoveProperties: false,
},
experimental: {
runtime: "experimental-edge",
serverComponents: true,
esmExternals: "loose",
},
pageExtensions: ["page.tsx", "page.ts", "page.jsx", "page.js"],
productionBrowserSourceMaps: useSourceMap,
useFileSystemPublicRoutes: false,
images: {
domains: ["cdn.i-scmp.com", "img.i-scmp.com"],
},
swcMinify: true,
reactStrictMode: true,
sentry: {
disableServerWebpackPlugin: process.env.SENTRY_DISABLE_WEBPACK_PLUGIN === "true",
disableClientWebpackPlugin: process.env.SENTRY_DISABLE_WEBPACK_PLUGIN === "true",
},
webpack: (config, { dev, isServer, webpack }) => {
// Set alias in webpack
config.resolve.alias = {
...config.resolve.alias,
"~": __dirname,
};
// add svg loader
config.module.rules.push({
test: /\.svg$/i,
issuer: /\.[jt]sx?$/,
use: [
{
loader: "@svgr/webpack",
options: {
svgoConfig: {
plugins: [
{
name: "removeViewBox",
active: false,
},
],
},
},
},
],
});
if (!isServer) {
useCDN &&
config.plugins.push(
new WebpackAliyunOssPlugin({
from: [".next/static/**", "public/sw.**"],
accessKeyId: oss.keyId,
accessKeySecret: oss.keySecret,
bucket: oss.bucket,
region: oss.region,
overwrite: true,
setOssPath(filePath) {
// Need to replace the path from ${pwd}/.next to _next/
// ref: https://nextjs.org/docs/api-reference/next.config.js/cdn-support-with-asset-prefix
return `/${envSlug}/${filePath
.replace(path.join(process.cwd(), "public"), "public")
.replace(path.join(process.cwd(), ".next"), "_next")}`;
},
setHeaders() {
return {
"Access-Control-Allow-Origin": siteUrl,
Vary: "Origin, Access-Control-Request-Headers, Access-Control-Request-Method",
"Cache-Control": "max-age=31536000",
};
},
}),
);
// Replace existing vendor config
// ref: https://github.com/vercel/next.js/blob/canary/packages/next/build/webpack-config.ts#L760
if (!dev) {
config.optimization.splitChunks.cacheGroups.lib.test = module => {
return /node_modules[/\\]/.test(module.nameForCondition() || "");
};
config.optimization.splitChunks.cacheGroups.lib.name = module => {
const packageName = module
.nameForCondition()
.match(/[\\/]node_modules[\\/](.*?)([\\/]|$)/)[1];
return `yarn.${packageName.replaceAll("@", "")}`;
};
}
// Ensures no server modules are included on the client.
config.plugins.push(new webpack.IgnorePlugin({ resourceRegExp: /@*.\.server$/ }));
}
return config;
},
};
// For removing duplicate atom key in the server stdout
// ref: https://github.com/facebookexperimental/Recoil/issues/733#issuecomment-729255961
nextConfig = withInterceptStdout(nextConfig, text =>
text.includes("Duplicate atom key") ? "" : text,
);
nextConfig = withPWA({
...nextConfig,
pwa: {
dest: "public",
disable: process.env.NODE_ENV !== "production",
swSrc: "lib/service-worker/index.ts",
},
});
module.exports = withSentryConfig(nextConfig, {
release: process.env.NEXT_PUBLIC_COMMIT_SHA,
}); |
…5479) In #5445, a change was made to the way the global `RewriteFrames` helper value is handled. Specifically, setting the default value (using the `||` operator) was moved to the place where the value is set rather than where it's retrieved. But if something goes wrong and for whatever reason the value never gets set globally, it now causes errors when the value is later used, because it has nothing to default to. This fixes that by restoring the default value to the old location, so that when it's used, it will never be undefined. Fixes #5478.
Is there an existing issue for this?
How do you use Sentry?
Self-hosted/on-premise
Which package are you using?
@sentry/nextjs
SDK Version
7.8.0
Framework Version
7.8.0
Link to Sentry event
No response
Steps to Reproduce
Use latest Sentry with NextJS
Expected Result
Should behave like 7.7.0 and not throw an error when building
Actual Result
The text was updated successfully, but these errors were encountered: