Skip to content

fix: inquirer.prompt is not a function with inquirer v12#413

Merged
shazron merged 2 commits into
masterfrom
copilot/fix-interactive-log-forwarding
Apr 28, 2026
Merged

fix: inquirer.prompt is not a function with inquirer v12#413
shazron merged 2 commits into
masterfrom
copilot/fix-interactive-log-forwarding

Conversation

Copilot AI commented Apr 27, 2026

Copy link
Copy Markdown
Contributor

Closes #412

This was a dep change made last year, but recent manual testing has found this bug, during interactive prompt for log forwarding set.

In inquirer v12, the CJS entry point no longer exposes prompt directly — it exports { createPromptModule, default }, with the classic API living on default. This caused aio rt namespace log-forwarding set to crash immediately with TypeError: inquirer.prompt is not a function.

Changes

  • src/commands/runtime/namespace/log-forwarding/set.js — destructure default on import so inquirer.prompt resolves correctly:

    // before
    const inquirer = require('inquirer')
    // after
    const { default: inquirer } = require('inquirer')
  • test/commands/runtime/namespace/log-forwarding/set.test.js — update mock assignment to target the same property the source now reads from:

    // before
    inquirer.prompt = prompt
    // after
    inquirer.default.prompt = prompt

@codecov

codecov Bot commented Apr 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Copilot AI changed the title [WIP] Fix inquirer.prompt is not a function error in log forwarding fix: inquirer.prompt is not a function with inquirer v12 Apr 27, 2026
Copilot AI requested a review from shazron April 27, 2026 15:54

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 PR Reviewer

This diff changes the inquirer import to use the .default property, which is the correct way to import ES modules that have been compiled to CommonJS with a default export wrapper. The test file is updated consistently to reflect this change. The modification is minimal and focused.

LGTM! This PR looks good to merge.


💡 How to re-trigger

Comment /review or /pr-reviewer on this PR

Comment thread src/commands/runtime/namespace/log-forwarding/set.js
@shazron shazron marked this pull request as ready for review April 27, 2026 15:56
@shazron shazron merged commit ebcff3c into master Apr 28, 2026
11 checks passed
@shazron shazron deleted the copilot/fix-interactive-log-forwarding branch April 28, 2026 07:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

interactive log forwarding set: inquirer.prompt is not a function

3 participants