next-translate-plugin icon indicating copy to clipboard operation
next-translate-plugin copied to clipboard

TypeError: Cannot read properties of undefined (reading 'slice')

Open burakkgunduzz opened this issue 2 years ago • 2 comments

What version of this package are you using? 2.0.5 What operating system, Node.js, and npm version? 18.15.0 What happened? if I use edge runtime in getServerSideProps I get error on page TypeError: Cannot read properties of undefined (reading 'slice'). What did you expect to happen? It should of work. Are you willing to submit a pull request to fix this bug? No

I am using next version 13.1.1 in a nx monorepo. I have this function below in a dynamic page (which does nothing)

export async function getServerSideProps(ctx) {
  return {
    props: { metrics: '' }
  }
}
 export const config = {
   runtime: 'experimental-edge'
 }

stack trace error - ../node_modules/next-translate-plugin/lib/cjs/node_modules/readable-stream/lib/_stream_writable.js (57:0) @ error - Cannot read properties of undefined (reading 'slice') null

burakkgunduzz avatar Apr 19 '23 14:04 burakkgunduzz

If I upgrade to next v13.3.0 the error becomes


error - ../../node_modules/html-tokenize/node_modules/readable-stream/lib/_stream_readable.js:43:0
Module not found: Can't resolve 'stream'

https://nextjs.org/docs/messages/module-not-found

Import trace for requested module:
../../node_modules/html-tokenize/node_modules/readable-stream/readable.js
../../node_modules/html-tokenize/index.js
../../node_modules/@emotion/server/create-instance/dist/emotion-server-create-instance.browser.esm.js
./pages/_document.js
../../node_modules/next/dist/build/webpack/loaders/next-edge-ssr-loader/index.js?absolute500Path=&absoluteAppPath=private-next-pages%2F_app&absoluteDocumentPath=private-next-pages%2F_document&absoluteErrorPath=private-next-pages%2F_error&absolutePagePath=%2FUsers%2Fburakgunduz%2FDocuments%2Fdevelopment%2Fwork%2Ffg-client%2Fapps%2Ffazla-market-web%2Fpages%2Fadmin%2Fmetrics%2Fcurrent-month%2Findex.js&buildId=development&dev=true&isServerComponent=false&page=%2Fadmin%2Fmetrics%2Fcurrent-month&stringifiedConfig=%7B%22env%22%3A%7B%7D%2C%22eslint%22%3A%7B%22ignoreDuringBuilds%22%3Atrue%7D%2C%22typescript%22%3A%7B%22ignoreBuildErrors%22%3Afalse%2C%22tsconfigPath%22%3A%22tsconfig.json%22%7D%2C%22distDir%22%3A%22..%2F..%2Fdist%2Fapps%2Ffazla-market-web%2F.next%22%2C%22cleanDistDir%22%3Atrue%2C%22assetPrefix%22%3A%22%22%2C%22configOrigin%22%3A%22next.config.js%22%2C%22useFileSystemPublicRoutes%22%3Atrue%2C%22generateEtags%22%3Atrue%2C%22pageExtensions%22%3A%5B%22tsx%22%2C%22ts%22%2C%22jsx%22%2C%22js%22%5D%2C%22poweredByHeader%22%3Atrue%2C%22compress%22%3Atrue%2C%22analyticsId%22%3A%22%22%2C%22images%22%3A%7B%22deviceSizes%22%3A%5B640%2C750%2C828%2C1080%2C1200%2C1920%2C2048%2C3840%5D%2C%22imageSizes%22%3A%5B16%2C32%2C48%2C64%2C96%2C128%2C256%2C384%5D%2C%22path%22%3A%22%2F_next%2Fimage%22%2C%22loader%22%3A%22default%22%2C%22loaderFile%22%3A%22%22%2C%22domains%22%3A%5B%22testing.fazla.com%22%2C%22app.fazla.com%22%2C%22fazlagida-test.s3.eu-central-1.amazonaws.com%22%2C%22fazlagida-production.s3.eu-central-1.amazonaws.com%22%5D%2C%22disableStaticImages%22%3Afalse%2C%22minimumCacheTTL%22%3A60%2C%22formats%22%3A%5B%22image%2Fwebp%22%5D%2C%22dangerouslyAllowSVG%22%3Afalse%2C%22contentSecurityPolicy%22%3A%22script-src%20'none'%3B%20frame-src%20'none'%3B%20sandbox%3B%22%2C%22contentDispositionType%22%3A%22inline%22%2C%22remotePatterns%22%3A%5B%5D%2C%22unoptimized%22%3Afalse%7D%2C%22devIndicators%22%3A%7B%22buildActivity%22%3Atrue%2C%22buildActivityPosition%22%3A%22bottom-right%22%7D%2C%22onDemandEntries%22%3A%7B%22maxInactiveAge%22%3A15000%2C%22pagesBufferLength%22%3A2%7D%2C%22amp%22%3A%7B%22canonicalBase%22%3A%22%22%7D%2C%22basePath%22%3A%22%22%2C%22sassOptions%22%3A%7B%7D%2C%22trailingSlash%22%3Afalse%2C%22i18n%22%3A%7B%22locales%22%3A%5B%22tr%22%2C%22en%22%5D%2C%22defaultLocale%22%3A%22tr%22%7D%2C%22productionBrowserSourceMaps%22%3Afalse%2C%22optimizeFonts%22%3Atrue%2C%22excludeDefaultMomentLocales%22%3Atrue%2C%22serverRuntimeConfig%22%3A%7B%7D%2C%22publicRuntimeConfig%22%3A%7B%22localeSubpaths%22%3A%7B%7D%7D%2C%22reactStrictMode%22%3Afalse%2C%22httpAgentOptions%22%3A%7B%22keepAlive%22%3Atrue%7D%2C%22outputFileTracing%22%3Atrue%2C%22staticPageGenerationTimeout%22%3A60%2C%22swcMinify%22%3Atrue%2C%22experimental%22%3A%7B%22clientRouterFilter%22%3Afalse%2C%22clientRouterFilterRedirects%22%3Afalse%2C%22fetchCacheKeyPrefix%22%3A%22%22%2C%22middlewarePrefetch%22%3A%22flexible%22%2C%22optimisticClientCache%22%3Atrue%2C%22manualClientBasePath%22%3Afalse%2C%22legacyBrowsers%22%3Afalse%2C%22newNextLinkBehavior%22%3Atrue%2C%22cpus%22%3A9%2C%22sharedPool%22%3Atrue%2C%22isrFlushToDisk%22%3Atrue%2C%22workerThreads%22%3Afalse%2C%22pageEnv%22%3Afalse%2C%22optimizeCss%22%3Afalse%2C%22nextScriptWorkers%22%3Afalse%2C%22scrollRestoration%22%3Afalse%2C%22externalDir%22%3Afalse%2C%22disableOptimizedLoading%22%3Afalse%2C%22gzipSize%22%3Atrue%2C%22swcFileReading%22%3Atrue%2C%22craCompat%22%3Afalse%2C%22esmExternals%22%3Atrue%2C%22appDir%22%3Afalse%2C%22isrMemoryCacheSize%22%3A52428800%2C%22fullySpecified%22%3Afalse%2C%22outputFileTracingRoot%22%3A%22%2FUsers%2Fburakgunduz%2FDocuments%2Fdevelopment%2Fwork%2Ffg-client%22%2C%22swcTraceProfiling%22%3Afalse%2C%22forceSwcTransforms%22%3Afalse%2C%22largePageDataBytes%22%3A128000%2C%22enableUndici%22%3Afalse%2C%22adjustFontFallbacks%22%3Afalse%2C%22adjustFontFallbacksWithSizeAdjust%22%3Afalse%2C%22typedRoutes%22%3Afalse%2C%22instrumentationHook%22%3Afalse%7D%2C%22configFile%22%3A%22%2FUsers%2Fburakgunduz%2FDocuments%2Fdevelopment%2Fwork%2Ffg-client%2Fapps%2Ffazla-market-web%2Fnext.config.js%22%2C%22configFileName%22%3A%22next.config.js%22%7D&pagesType=pages&appDirLoader=&sriEnabled=false&incrementalCacheHandlerPath=!
Watchpack Error (initial scan): Error: ENOTDIR: not a directory, scandir '/Users/burakgunduz/Documents/development/work/fg-client/node_modules/next/dist/pages/_document.js'

Any ideas? is it related to next-translate-plugin or ?

burakkgunduzz avatar Apr 19 '23 14:04 burakkgunduzz

Can you try it with the latest version? There are some improvements in 2.3. Thanks

aralroca avatar Jun 19 '23 20:06 aralroca