Make WordPress Core

Opened 5 months ago

Last modified 7 days ago

#65223 accepted defect (bug)

Connectors plugin install flow does not show filesystem credentials form when FTP is required

Reported by: ekamran Owned by: westonruter
Priority: normal Milestone: 7.2
Component: AI Version: 7.0
Severity: normal Keywords: has-test-info has-patch has-unit-tests
Cc: Focuses: javascript, administration

Description

When installing a connector plugin from Settings > Connectors on a site that requires filesystem credentials, the install attempt fails with a generic notice instead of showing the standard "Connection Information" filesystem credentials form.

The regular Plugins > Add Plugin installer shows the credentials form correctly for the same plugin in the same environment.

Steps to Reproduce

  1. Install WordPress 7.0-RC3.
  2. Log in as an administrator.
  3. Force filesystem credentials, for example by setting FS_METHOD to ftpext in wp-config.php.
  4. Ensure the AI plugin is installed and active.
  5. Ensure one connector provider plugin is not installed, for example ai-provider-for-anthropic.
  6. Go to Settings > Connectors.
  7. Click Install for Anthropic.

Actual Results

The page stays on Settings > Connectors and shows a generic notice:

Failed to install plugin for Anthropic.

No filesystem credentials modal is shown.

Expected Results

The Connectors install flow should surface the standard WordPress "Connection Information" modal so the administrator can enter FTP credentials, matching the behavior of Plugins > Add Plugin.

Control Test

Using the same environment and the same plugin:

  1. Go to Plugins > Add Plugin.
  2. Search for ai-provider-for-anthropic.
  3. Click Install Now.

This correctly opens the "Connection Information" dialog with Hostname, FTP Username, FTP Password, and Connection Type fields.

Environment

WordPress: 7.0-RC3
AI plugin: 0.9.0
Connector tested: AI Provider for Anthropic 1.0.2
Filesystem method: ftpext
Environment: Local Docker wp-env

Notes

This appears to affect the Connectors page install flow that uses the REST plugin save flow. The standard plugin installer handles the filesystem credentials case correctly, so this may need special handling in the Connectors install action.

Attachments (3)

core-bug.png​ (338.0 KB ) - added by gaurangsondagar 5 months ago.
Screenshot_1.png​ (68.3 KB ) - added by mirmpro 3 months ago.
Screenshot_2.png​ (58.4 KB ) - added by mirmpro 3 months ago.

Download all attachments as: .zip

Change History (25)

#1 @westonruter
5 months ago

  • Milestone Awaiting Review → 7.0

Related: ​https://github.com/WordPress/gutenberg/issues/77352

If we can't fix this for 7.0 properly, at least we could treat a FS_METHOD of ftpext as being the same as DISALLOW_FILE_MODS.

#2 @westonruter
5 months ago

The actual work for this would need to be done in the Gutenberg repo. For a recent PR touching these files, see ​https://github.com/WordPress/gutenberg/pull/77521

See also ​https://github.com/WordPress/wordpress-develop/pull/11779

#3 @manhar
5 months ago

Confirmed the bug on WordPress 7.0-RC3. No patch exists yet — I'm looking into the Connectors install flow in Gutenberg. The relevant files appear to be touched in gutenberg/pull/77521. Will follow up with a patch if feasible.

#4 @westonruter
5 months ago

In order to test this out myself, I wanted to ensure that my wordpress-develop environment was configured with a live FTP filesystem method. I created a repo with instructions for how to set this up: ​https://github.com/westonruter/wordpress-develop-ftp-fs

With that active, I can confirm when attempting to install the Open AI provider I get an error:

Failed to install plugin for OpenAI.

Note: Make sure the ftp_credentials is deleted in WordPress options to ensure the credentials dialog is opened.

Last edited 5 months ago by westonruter (previous) (diff)

#5 @ekamran
5 months ago

Thanks for confirming this.

I re-tested this against WordPress 7.0-RC4 and can still reproduce the same behavior with FS_METHOD set to ftpext.

In this setup, the standard Plugins > Add Plugin flow opens the expected “Connection Information” FTP credentials modal, but installing a provider from Settings > Connectors still stays on the Connectors screen and shows the generic error notice instead.

I’m happy to help test a patch for this flow, or help with a Gutenberg-side fix if that would be useful.

#6 @westonruter
5 months ago

  • Keywords has-patch added; needs-patch removed

@ekamran Thanks!

I have created a Gutenberg PR (with the help of Claude): ​https://github.com/WordPress/gutenberg/pull/78367

Please test.

#7 @westonruter
5 months ago

  • Owner set to westonruter
  • Status new → accepted

#8 @gaurangsondagar
5 months ago

Patch Testing Report:

Patch Tested: ​https://github.com/WordPress/gutenberg/pull/78367

The environment I am using below:

  • PHP: 8.2.x
  • WordPress: 7.0-RC4
  • Web server: Apache
  • Database: MySQL
  • Browser: Chrome
  • OS: Windows 11
  • Theme: Twenty Twenty-Five

Steps I followed:

  • Installed WordPress 7.0-RC4 and logged in as an Administrator.
  • Forced filesystem credentials by setting FS_METHOD to ftpext in the wp-config.php file.
  • Verified that the AI plugin was installed and active, while the ai-provider-for-anthropic plugin was not yet installed.
  • Navigated to Connectors and clicked the Install button for Anthropic.

Result:

  • Before applying the patch, I encountered the error: "Failed to install plugin for Anthropic."
  • After applying the patch, the FTP credentials modal appeared correctly when clicking the Install button for Anthropic.

#9 @ekamran
5 months ago

I re-tested the latest Gutenberg PR branch locally with FS_METHOD set to ftpext.

After rebuilding the Gutenberg assets, I can confirm the filesystem credentials modal now appears for both flows I checked:

  • Installing a provider connector from Settings > Connectors.
  • Installing the AI plugin from the top callout on Settings > Connectors.

I also noted a failing targeted unit test on the Gutenberg PR itself, so I left the detailed test output there to keep the code-specific discussion on GitHub.

#10 @westonruter
5 months ago

@ekamran Thanks. I followed up with a commit to fix the tests.

This ticket was mentioned in ​Slack in #core by audrasjb. ​View the logs.


5 months ago

#12 @audrasjb
5 months ago

This will be fixed by this Gutenberg PR: ​https://github.com/WordPress/gutenberg/pull/78367
@wildworks @westonruter do you think this one is realistic for 7.0 final RC scheduled today? I'd say we can fix this in 7.0.1.

#13 @audrasjb
5 months ago

  • Milestone 7.0 → 7.0.1

As per today's bug scrub and according to @wildworks's feedback, I'm moving this ticket to 7.0.1 as it will need more review and work.

#14 @audrasjb
5 months ago

Removing trunk version as this is not going to be shipped with WP 7.0 but in the next releases.

#15 @riccardodicurti
4 months ago

@audrasjb does this ticket still need more testing, or has it been fixed by the Gutenberg PR ​https://github.com/WordPress/gutenberg/pull/78367 you shared?

This ticket was mentioned in ​Slack in #core by masteradhoc. ​View the logs.


4 months ago

#17 @masteradhoc
3 months ago

  • Milestone 7.0.1 → 7.0.2

As the RC for WP 7.0.1 is expected to land tomorrow we'll have to punt this to 7.0.2.

#18 @logicrays
3 months ago

Reproduction Report

Environment

The environment I am using below:

Steps taken

  1. Added define( 'FS_METHOD', 'ftpext' ); to wp-config.php (no FTP credentials defined)
  2. Logged in as Administrator on WordPress 7.1-alpha
  3. Navigated to Plugins > Add New and attempted to install Hello Dolly, FTP credentials modal appeared correctly
  4. Navigated to Settings > Connectors
  5. Clicked Install for OpenAI connector
  6. 🐞 Bug occurs

Expected behavior

  • The FTP/Connection Information modal should appear on Connectors when installing a provider plugin, same as Plugins > Add New

Actual behavior

  • On Connectors: snackbar error "Failed to install plugin for OpenAI." with no credentials modal
  • On Plugins > Add New: credentials modal appears as expected (control test)

Additional Notes

  • Local Sites environment (nginx, PHP 8.2)
  • FS_METHOD correctly forces FTP mode, confirmed via Plugins > Add New control test

Screenshots/Screencast with results

#19 @jorbin
3 months ago

  • Milestone 7.0.2 → 7.0.3

#20 @mirmpro
3 months ago

Test Report

Patch tested: ​https://github.com/WordPress/wordpress-develop/pull/78367

Environment

  • WordPress: 7.0-RC3
  • Subdirectory: No
  • PHP: 8.3.32
  • Server: PHP.wasm
  • Database: WP_SQLite_Driver (Server: 8.0.38 / Client: 3.51.0)
  • Browser: Chrome 150.0.0.0
  • OS: Windows 10/11
  • Theme: Twenty Twenty-Five 1.5
  • MU Plugins: None activated
  • Plugins:
    • Test Reports 1.3.0
    • WordPress Beta Tester 4.0.0

Steps taken

  1. Configured the file system method by adding define( 'FS_METHOD', 'ftpext' ); in wp-config.php.
  2. Applied pull request / patch #78367 in the testing environment.
  3. Logged into the WordPress admin dashboard as an administrator.
  4. Ensured the core AI plugin was active and the AI Provider for Anthropic plugin was uninstalled.
  5. Navigated to Settings > Connectors and clicked the Install button for Anthropic.
  6. Handled the filesystem credentials prompt when required.
  7. Verified that the plugin installed successfully and the API Key input field appeared correctly.
  8. Patch is solving the problem

Expected result

  • The Connectors installation flow should successfully handle filesystem credentials when required and proceed to install the plugin, revealing the API key configuration field.

Actual Results

  • The patch works as expected. The plugin installed successfully through the Settings > Connectors flow under a restricted filesystem method, and the API Key input field appeared correctly.

Additional Notes

Screenshots/Screencast with results

  • Yes

Support Content

  • N/A

@mirmpro
3 months ago

@mirmpro
3 months ago

#21 @westonruter
2 months ago

  • Milestone 7.0.3 → 7.2

This ticket was mentioned in ​PR #13953 on ​WordPress/wordpress-develop by ​@sheldorofazeroth.


7 days ago
#22

  • Keywords has-unit-tests added

When the filesystem method requires credentials that are not stored (for example, FS_METHOD is ftpext), installing a connector plugin from Settings > Connectors fails with "Failed to install plugin for X." The REST API plugins endpoint rejects the request up front (fs_unavailable) and cannot take credentials. Plugins > Add Plugin works in the same environment because it uses wp.updates.installPlugin(), which shows the "Connection Information" modal.

The Gutenberg PR changes the Connectors client to install through wp.updates.installPlugin() when credentials are needed. This PR adds the server-side pieces that flow needs:

  • src/wp-admin/options-connectors.php: enqueues the updates script and prints wp_print_request_filesystem_credentials_modal() and wp_print_admin_notice_templates(), the same way plugin-install.php and import.php do. The modal is only printed when credentials are actually required.
  • src/wp-includes/connectors.php: adds a filesystemCredentialsRequired flag to the Connectors script module data. It is true only when the filesystem method is not direct and no credentials are stored. This is the same check WP_REST_Plugins_Controller::is_filesystem_available() uses, so the client switches to wp.updates in exactly the cases where REST would fail.
  • Tests: covers the flag for direct, for a non-direct method without stored credentials, and for a non-direct method with stored credentials.

The PHP changes do nothing on their own. They take effect once the Gutenberg change lands and the pinned Gutenberg hash is bumped. Until then, the extra script and markup on this screen are inert.

Testing Instructions

Automated:

npm run test:php -- --group connectors

Manual (needs the Gutenberg change from WordPress/gutenberg#78367 in the build):

  1. Set define( 'FS_METHOD', 'ftpext' ); in wp-config.php, and do not store FTP credentials.
  2. Make sure the AI plugin is active and a provider plugin (for example, ai-provider-for-anthropic) is not installed.
  3. Go to Settings > Connectors and click Install for that provider.
  4. Expected: the "Connection Information" modal opens. Valid credentials install and activate the plugin. Cancel aborts with no error notice.
  5. Remove the FS_METHOD line and repeat. The install goes through REST with no modal, as before.

Server-side check without the Gutenberg change: with FS_METHOD set to ftpext, the Connectors page source contains #request-filesystem-credentials-dialog and "filesystemCredentialsRequired":true. With direct, there is no modal and the flag is false.

Note: See TracTickets for help on using tickets.