verbb / formie

The most user-friendly forms plugin for Craft CMS.
Other
96 stars 72 forks source link

Craft 4: "Failed to instantiate component or class "nystudio107\pluginvite\services\VitePluginService"." #897

Closed magicspon closed 2 years ago

magicspon commented 2 years ago

Description

When trying to view a form in the backend, an error is thrown

Steps to reproduce

  1. Go to formie
  2. Go to edit a form

Form settings

Additional info

Additional context

Not instantiable – [yii\di\NotInstantiableException](http://www.yiiframework.com/doc-2.0/yii-di-notinstantiableexception.html)
Failed to instantiate component or class "nystudio107\pluginvite\services\VitePluginService".
↵
Caused by: ReflectionException
Class "nystudio107\pluginvite\services\VitePluginService" does not exist
in /app/vendor/yiisoft/yii2/di/Container.php at line 507

1. in /app/vendor/yiisoft/yii2/di/Container.phpat line 509
500501502503504505506507508509510511512513514515516517518    {
        if (isset($this->_reflections[$class])) {
            return [$this->_reflections[$class], $this->_dependencies[$class]];
        }

        $dependencies = [];
        try {
            $reflection = new ReflectionClass($class);
        } catch (\ReflectionException $e) {
            throw new NotInstantiableException(
                $class,
                'Failed to instantiate component or class "' . $class . '".',
                0,
                $e
            );
        }

        $constructor = $reflection->getConstructor();
        if ($constructor !== null) {
2. in /app/vendor/yiisoft/yii2/di/Container.php at line 385– [yii\di\Container::getDependencies](http://www.yiiframework.com/doc-2.0/yii-di-container.html#getDependencies()-detail)('nystudio107\pluginvite\services\...')
3. in /app/vendor/yiisoft/yii2/di/Container.php at line 170– [yii\di\Container::build](http://www.yiiframework.com/doc-2.0/yii-di-container.html#build()-detail)('nystudio107\pluginvite\services\...', [], ['assetClass' => 'verbb\formie\web\assets\forms\Fo...', 'useDevServer' => true, 'devServerPublic' => 'http://localhost:4000/', 'errorEntry' => 'js/main.js', ...])
4. in /app/vendor/yiisoft/yii2/BaseYii.php at line 365– [yii\di\Container::get](http://www.yiiframework.com/doc-2.0/yii-di-container.html#get()-detail)('nystudio107\pluginvite\services\...', [], ['assetClass' => 'verbb\formie\web\assets\forms\Fo...', 'useDevServer' => true, 'devServerPublic' => 'http://localhost:4000/', 'errorEntry' => 'js/main.js', ...])
5. in /app/vendor/yiisoft/yii2/di/ServiceLocator.php at line 137– [yii\BaseYii::createObject](http://www.yiiframework.com/doc-2.0/yii-baseyii.html#createObject()-detail)(['assetClass' => 'verbb\formie\web\assets\forms\Fo...', 'useDevServer' => true, 'devServerPublic' => 'http://localhost:4000/', 'errorEntry' => 'js/main.js', ...])
6. in /app/vendor/yiisoft/yii2/base/Module.php at line 769– [yii\di\ServiceLocator::get](http://www.yiiframework.com/doc-2.0/yii-di-servicelocator.html#get()-detail)('vite', false)
7. in /app/vendor/verbb/formie/src/base/PluginTrait.php at line 174– [yii\base\Module::get](http://www.yiiframework.com/doc-2.0/yii-base-module.html#get()-detail)('vite')
168169170171172173174175176177178179180    {
        return $this->get('tokens');
    }

    public function getVite(): VitePluginService
    {
        return $this->get('vite');
    }

    // Private Methods
    // =========================================================================

8. in /app/vendor/verbb/formie/src/helpers/Plugin.php at line 14– verbb\formie\Formie::getVite()
891011121314151617181920{
    // Static Methods
    // =========================================================================

    public static function registerAsset(string $path): void
    {
        $viteService = Formie::$plugin->getVite();

        $scriptOptions = [
            'depends' => [
                FormsAsset::class,
            ],
            'onload' => "document.dispatchEvent(new CustomEvent('vite-script-loaded',{detail:{path:'$path'}}));",
9. in /app/vendor/verbb/formie/src/controllers/FormsController.php at line 128– verbb\formie\helpers\Plugin::registerAsset('src/js/formie-form.js')
122123124125126127128129130131132133134        $variables['baseCpEditUrl'] = 'formie/forms/edit/{id}';

        // Set the "Continue Editing" URL
        $variables['continueEditingUrl'] = $variables['baseCpEditUrl'] .
            (Craft::$app->getIsMultiSite() && Craft::$app->getSites()->currentSite->id !== $variables['site']->id ? '/' . $variables['site']->handle : '');

        Plugin::registerAsset('src/js/formie-form.js');

        return $this->renderTemplate('formie/forms/_edit', $variables);
    }

    /**
     * Saves a form.
10. verbb\formie\controllers\FormsController::actionEdit(11553, null, null)
11. in /app/vendor/yiisoft/yii2/base/InlineAction.php at line 57– call_user_func_array([verbb\formie\controllers\FormsController, 'actionEdit'], [11553, null, null])
12. in /app/vendor/yiisoft/yii2/base/Controller.php at line 178– [yii\base\InlineAction::runWithParams](http://www.yiiframework.com/doc-2.0/yii-base-inlineaction.html#runWithParams()-detail)(['formId' => '11553', 'site' => 'default'])
13. in /app/vendor/yiisoft/yii2/base/Module.php at line 552– [yii\base\Controller::runAction](http://www.yiiframework.com/doc-2.0/yii-base-controller.html#runAction()-detail)('edit', ['formId' => '11553', 'site' => 'default'])
14. in /app/vendor/craftcms/cms/src/web/Application.php at line 301– [yii\base\Module::runAction](http://www.yiiframework.com/doc-2.0/yii-base-module.html#runAction()-detail)('formie/forms/edit', ['formId' => '11553', 'site' => 'default'])
295296297298299300301302303304305306307     * @param string $route
     * @param array $params
     * @return Response|null The result of the action, normalized into a Response object
     */
    public function runAction($route, $params = []): ?BaseResponse
    {
        $result = parent::runAction($route, $params);

        if ($result === null || $result instanceof Response) {
            return $result;
        }

        $response = $this->getResponse();
15. in /app/vendor/yiisoft/yii2/web/Application.php at line 103– craft\web\Application::runAction('formie/forms/edit', ['formId' => '11553', 'site' => 'default'])
16. in /app/vendor/craftcms/cms/src/web/Application.php at line 286– [yii\web\Application::handleRequest](http://www.yiiframework.com/doc-2.0/yii-web-application.html#handleRequest()-detail)(craft\web\Request)
280281282283284285286287288289290291292        if (($response = $this->_processActionRequest($request)) !== null) {
            return $response;
        }

        // If we’re still here, finally let Yii do its thing.
        try {
            return parent::handleRequest($request);
        } catch (Throwable $e) {
            $this->_unregisterDebugModule();
            throw $e;
        }
    }

17. in /app/vendor/yiisoft/yii2/base/Application.php at line 384– craft\web\Application::handleRequest(craft\web\Request)
18. in /app/web/index.php at line 26– [yii\base\Application::run](http://www.yiiframework.com/doc-2.0/yii-base-application.html#run()-detail)()
20212223242526define('CRAFT_ENVIRONMENT', getenv('ENVIRONMENT') ?: 'production');
// ...

// Load and run Craft
/** @var craft\web\Application $app */
$app = require CRAFT_VENDOR_PATH . '/craftcms/cms/bootstrap/web.php';
$app->run();
$_GET = [
    'site' => 'default',
];

$_COOKIE = [
    '__stripe_mid' => '7e3e502e-590a-49ca-8620-7228a029f404f8207d',
    '5f5ff957a2b8471c4b0f882b9a904639_username' => '2546714b99d52dd58b20f2ae3598abb07023cea280ab27093d8a68bcbadb6b81a:2:{i:0;s:41:"5f5ff957a2b8471c4b0f882b9a904639_username";i:1;s:13:"dave.stockley";}',
    'CraftSessionId' => '8a8341011bea8d22886285d552cf4df7',
    '5f5ff957a2b8471c4b0f882b9a904639_identity' => '0307a1996750492f7f4284561ff1eb969af544e67cb22f638638bea41478d2f7a:2:{i:0;s:41:"5f5ff957a2b8471c4b0f882b9a904639_identity";i:1;s:159:"[1,"[\\"H3WMwcPnlGnG-hZILGpY8SZxOFp1vR1kBWC_DIZq1-x0Y4uHOo2mZxloy9UInBFrMOqTc4KdNt-zW6RqjfWkjX0PX2Mhkvk1eyFU\\",null,\\"07aa961a4a130bcbe106c948cc8c58d4\\"]",3600]";}',
    'CRAFT_CSRF_TOKEN' => '4ce1bfe4ef96dd47a7af40a11bd6b7917e14e9d825b46df825ca8dafca000f47a:2:{i:0;s:16:"CRAFT_CSRF_TOKEN";i:1;s:147:"HBf_-4skxvJnJsNFsf7OzkLOBcbQBTgoFVe4c6gp|b1bbf29432531d6009eeb0f159f2a5ec29b40f7944c467b25b413e8c70ec35eaHBf_-4skxvJnJsNFsf7OzkLOBcbQBTgoFVe4c6gp|1";}',
];

$_SESSION = [
    'a3409f2f7ad002412b0d969b119646d8__flash' => [],
    'a3409f2f7ad002412b0d969b119646d8__auth_access' => [
        'seomaticPreviewAuthorizationKey15',
        'previewElement:15',
        'saveAssets:1',
        'saveAssets:7',
        'previewDraft:1216',
        'seomaticPreviewAuthorizationKey35262',
        'previewDraft:1218',
        'seomaticPreviewAuthorizationKey35292',
        'seomaticPreviewAuthorizationKey3548',
        'previewElement:3548',
        'previewDraft:1221',
        'seomaticPreviewAuthorizationKey35335',
        'editStructure:4',
        'seomaticPreviewAuthorizationKey74',
        'previewElement:74',
        'previewDraft:1223',
        'seomaticPreviewAuthorizationKey35357',
        'seomaticPreviewAuthorizationKey7312',
        'previewElement:1970',
        'seomaticPreviewAuthorizationKey25325',
        'previewElement:25325',
        'previewDraft:1235',
        'seomaticPreviewAuthorizationKey35411',
        'seomaticPreviewAuthorizationKey28414',
        'previewElement:28414',
        'previewDraft:1241',
        'seomaticPreviewAuthorizationKey35424',
        'seomaticPreviewAuthorizationKey32962',
        'previewElement:32962',
    ],
    '5f5ff957a2b8471c4b0f882b9a904639__token' => 'H3WMwcPnlGnG-hZILGpY8SZxOFp1vR1kBWC_DIZq1-x0Y4uHOo2mZxloy9UInBFrMOqTc4KdNt-zW6RqjfWkjX0PX2Mhkvk1eyFU',
    '5f5ff957a2b8471c4b0f882b9a904639__id' => 1,
    '__authKey' => '["H3WMwcPnlGnG-hZILGpY8SZxOFp1vR1kBWC_DIZq1-x0Y4uHOo2mZxloy9UInBFrMOqTc4KdNt-zW6RqjfWkjX0PX2Mhkvk1eyFU",null,"07aa961a4a130bcbe106c948cc8c58d4"]',
    '5f5ff957a2b8471c4b0f882b9a904639__expire' => 1653348552,
    '__duration' => 3600,
];
engram-design commented 2 years ago

Should be fixed in 2.0.0-beta.9

magicspon commented 2 years ago

indeed it is... thanks