Skip to content
This repository has been archived by the owner on Mar 15, 2024. It is now read-only.

next server fails to launch #109

Closed
dustinbyrne opened this issue Jul 14, 2022 · 3 comments · Fixed by #110
Closed

next server fails to launch #109

dustinbyrne opened this issue Jul 14, 2022 · 3 comments · Fixed by #110
Assignees
Labels

Comments

@dustinbyrne
Copy link
Contributor

One of two errors may appear. This issue is easily recreated using a sample project and created along with the following commands:

$ npx create-next-app nextjs-blog --use-npm --example "https://github.com/vercel/next-learn/tree/master/basics/learn-starter"
$ cd nextjs-blog
$ npx @appland/appmap install
$ npx appmap-agent-js -- node node_modules/.bin/next dev -p 3001

The errors are as follows:

$ npx appmap-agent-js -- node node_modules/.bin/next dev -p 3001
(node:95565) ExperimentalWarning: --experimental-loader is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
(node:95565) DeprecationWarning: Obsolete loader hook(s) supplied and will be ignored: transformSource
ready - started server on 0.0.0.0:3001, url: http://localhost:3001
/Users/dustin/dev/tmp/next-test/nextjs-blog/node_modules/next/dist/bin/next:158
commands[command]().then((exec)=>exec(forwardedArgs)).then(()=>{
                                 ^

TypeError: exec is not a function
    at /Users/dustin/dev/tmp/next-test/nextjs-blog/node_modules/next/dist/bin/next:158:34
$ npx appmap-agent-js -- node node_modules/.bin/next dev -p 3001
/Users/dustin/dev/tmp/next-test/nextjs-blog/node_modules/@appland/appmap-agent-js/lib/node/abomination.js:38
      throw new Error(
      ^

Error: Unable to solve the file extension issue of ESM loader -- see: https://github.com/nodejs/node/issues/41465
    at Function.executeUserEntryPoint [as runMain] (/Users/dustin/dev/tmp/next-test/nextjs-blog/node_modules/@appland/appmap-agent-js/lib/node/abomination.js:38:13)
    at node:internal/main/run_main_module:17:47
@lachrist
Copy link
Contributor

Hi @dustinbyrne thanks for the bug report. The second issue is probably due to you tempering with a bin file in the next npm module. Extension-less files cause problems -- cf: nodejs/node#41465. So I rename them with an explicit .cjs extension. If the extension-less file and the .cjs file are not identical, I crash the agent instead of continuing with something inconsistent. We could discuss whether a simple warning would suffice. I'm looking at the root failure now.

@lachrist lachrist mentioned this issue Jul 18, 2022
@lachrist
Copy link
Contributor

lachrist commented Sep 2, 2022

@dustinbyrne I got the agent to produce interesting appmaps but the viewer is not showing much. Should @dividedmind proceed with the reviewing?

To reproduce:

git clone https://github.com/land-of-apps/agent-js-sandbox.git
cd agent-js-sandbox
node bin/nextjs-blog.mjs nextjs-fix
cd nextjs-blog
npx appmap-agent-js

Screenshot 2022-09-02 at 18 14 45

anonymous.appmap.json.zip

@appland-release
Copy link

🎉 This issue has been resolved in version 11.3.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants