Skip to content

Error when using installPlugin #186

@johnhooks

Description

@johnhooks

The problem

I received the following error when attempting to use the installPlugin function.

Uncaught (in promise) TypeError: Failed to construct 'FormData': parameter 1 is not of type 'HTMLFormElement'.

Some troubleshooting

The error originated from line 16:

const pluginFormPage = asDOM(pluginForm);
const pluginFormData = new FormData(
pluginFormPage.querySelector('.wp-upload-form')! as HTMLFormElement
) as any;

I checked the selectors, and they look right. Perhaps it is something wrong with the request in the following? I double checked the url and it works in a regular WordPress instance. But I am unfamiliar with how to debug a request through the ServiceWorker.

const pluginForm = await playground.request({
relativeUrl: '/wp-admin/plugin-install.php?tab=upload',
});

Additional information

This is the project in which I am getting the error. It's pretty simple, I'm just trying to figure out a bare minimum implementation of this to showcase a plugin in development.

https://github.com/johnhooks/playground-experiment

The current version of the site is hosted here if you want to examine the issue in the wild.

https://johnhooks.io/playground-experiment/

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions