Skip to content

Error "TypeError: getObjectPath is not a function" in NextJS 14.0.4 #71

Open
@kjetilkh-politiet

Description

@kjetilkh-politiet

Hello, I'm trying to call the scan function programmatically in NextJS 14.0.4. I seem to get the following error in NextJS in both server actions and using a route handler An error occured while scanning TypeError: getObjectPath is not a function.

My overall goal was to try to scan multiple targets and creating some sort of table or dashboard.

Reproducability: I've installed NextJS with npx create-next-app@latest, then installed react-scanner as a dependency. I could create a minimum repo if desired.

Full error stack:

An error occured while scanning TypeError: getObjectPath is not a function
at Object.exit (webpack-internal:///(action-browser)/./node_modules/react-scanner/src/scan.js:161:37)
at walk (webpack-internal:///(action-browser)/./node_modules/astray/dist/index.mjs:132:21)
at walk (webpack-internal:///(action-browser)/./node_modules/astray/dist/index.mjs:125:19)
at walk (webpack-internal:///(action-browser)/./node_modules/astray/dist/index.mjs:125:19)
at walk (webpack-internal:///(action-browser)/./node_modules/astray/dist/index.mjs:87:19)
at walk (webpack-internal:///(action-browser)/./node_modules/astray/dist/index.mjs:125:19)
at walk (webpack-internal:///(action-browser)/./node_modules/astray/dist/index.mjs:125:19)
at walk (webpack-internal:///(action-browser)/./node_modules/astray/dist/index.mjs:125:19)
at walk (webpack-internal:///(action-browser)/./node_modules/astray/dist/index.mjs:87:19)
at Module.walk (webpack-internal:///(action-browser)/./node_modules/astray/dist/index.mjs:125:19)
at scan (webpack-internal:///(action-browser)/./node_modules/react-scanner/src/scan.js:80:12)
at run (webpack-internal:///(action-browser)/./node_modules/react-scanner/src/run.js:26:9)
at Object.run (webpack-internal:///(action-browser)/./node_modules/react-scanner/src/scanner.js:8:26)
at scan (webpack-internal:///(action-browser)/./actions/scan.ts:17:83)
at endpoint (webpack-internal:///(action-browser)/./node_modules/next/dist/build/webpack/loaders/next-flight-action-entry-loader.js?actions=%5B%5B%22%2Fhome%2FPOLITIET%2Fkkh009%2Fgit%2Freact-scanner-nextjs%2Factions%2Fscan.ts%22%2C%5B%22scan%22%5D%5D%5D&client_imported=true!:8:17)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async /some/path/react-scanner-nextjs/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:39:406
at async t0 (/some/path/react-scanner-nextjs/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:38:5773)
at async rh (/some/path/react-scanner-nextjs/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:39:23636)
at async doRender (/some/path/react-scanner-nextjs/node_modules/next/dist/server/base-server.js:1391:30)
at async cacheEntry.responseCache.get.routeKind (/some/path/react-scanner-nextjs/node_modules/next/dist/server/base-server.js:1552:28)
at async DevServer.renderToResponseWithComponentsImpl (/some/path/react-scanner-nextjs/node_modules/next/dist/server/base-server.js:1460:28)
at async DevServer.renderPageComponent (/some/path/react-scanner-nextjs/node_modules/next/dist/server/base-server.js:1843:24)
at async DevServer.renderToResponseImpl (/some/path/react-scanner-nextjs/node_modules/next/dist/server/base-server.js:1881:32)
at async DevServer.pipeImpl (/some/path/react-scanner-nextjs/node_modules/next/dist/server/base-server.js:909:25)
at async NextNodeServer.handleCatchallRenderRequest (/some/path/react-scanner-nextjs/node_modules/next/dist/server/next-server.js:266:17)
at async DevServer.handleRequestImpl (/some/path/react-scanner-nextjs/node_modules/next/dist/server/base-server.js:805:17)

Truth be told, I get a bunch of other errors/warnings as well, which may or may not be related:

⚠ ./node_modules/react-scanner/node_modules/typescript/lib/typescript.js
Critical dependency: the request of a dependency is an expression

Import trace for requested module:
./node_modules/react-scanner/node_modules/typescript/lib/typescript.js
./node_modules/react-scanner/node_modules/@typescript-eslint/typescript-estree/dist/parser.js
./node_modules/react-scanner/node_modules/@typescript-eslint/typescript-estree/dist/index.js
./node_modules/react-scanner/src/scan.js
./node_modules/react-scanner/src/run.js
./node_modules/react-scanner/src/scanner.js
./actions/scan.ts

./node_modules/react-scanner/node_modules/typescript/lib/typescript.js
Module not found: Can't resolve 'source-map-support' in '/some/path/git/react-scanner-nextjs/node_modules/react-scanner/node_modules/typescript/lib'

Import trace for requested module:
./node_modules/react-scanner/node_modules/typescript/lib/typescript.js
./node_modules/react-scanner/node_modules/@typescript-eslint/typescript-estree/dist/parser.js
./node_modules/react-scanner/node_modules/@typescript-eslint/typescript-estree/dist/index.js
./node_modules/react-scanner/src/scan.js
./node_modules/react-scanner/src/run.js
./node_modules/react-scanner/src/scanner.js
./actions/scan.ts

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions