Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to create resource when use the hotkey: "c" on resource index (bug introduced in nova 2.10.0) #2326

Closed
henryavila opened this issue Feb 5, 2020 · 13 comments
Labels
bug Verified bug by the Nova team

Comments

@henryavila
Copy link

  • Laravel Version: 6.14.0
  • Nova Version: 2.10.0

Description:

In any resource index page, if I press the hotkey "c" to go to create page, the creation will fail returning the error:

 Call to a member function newQueryWithoutScopes() on null {"userId":1,"exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalThrowableError(code: 0): Call to a member function newQueryWithoutScopes() on null at /var/www/vendor/laravel/nova/src/Http/Requests/InteractsWithRelatedResources.php:37)

If in index page, I click on "+ Add" button, the resource will be created withou problem.

I've tested in nova 2.9.4 and 2.10.0. The error happen just in the 2.10.0 version

Steps To Reproduce:

  • Update laravel nova to 2.10.0
  • Open any resouce index page
  • Press the "c" hotkey to go to create page
  • Fill the required fields
  • Press the Create button
@IMPMAC
Copy link

IMPMAC commented Feb 5, 2020

It looks like the URL needs to have the parameters ?viaResource=&viaResourceId=&viaRelationship= If they are included. It seems to work.

@davidhemphill davidhemphill added the bug Verified bug by the Nova team label Feb 5, 2020
@davidhemphill
Copy link
Contributor

Fixed via laravel/nova@13fe921429ff538a2f005a706993146a8dcd812a

@henryavila
Copy link
Author

It looks like the URL needs to have the parameters ?viaResource=&viaResourceId=&viaRelationship= If they are included. It seems to work.

in v2.9.4 the url don't have the queryParams and works

@newtongamajr
Copy link

Laravel 6.14.0
Nova 2.10.1

Still getting the same error on Nova 2.10.1

Open any resouce index page
Press the "c" hotkey to go to create page or use the normal 'Create' Button
Fill the required fields
Press the Create button

Call to a member function newQueryWithoutScopes() on null
/home/newton/git/laravel/nova/galileo/vendor/laravel/nova/src/Http/Requests/InteractsWithRelatedResources.php#37
Symfony\Component\Debug\Exception\FatalThrowableError
#0 /home/newton/git/laravel/nova/galileo/vendor/spatie/once/src/functions.php(27): Laravel\Nova\Http\Requests\NovaRequest->Laravel\Nova\Http\Requests{closure}(Array)
#1 /home/newton/git/laravel/nova/galileo/vendor/laravel/nova/src/Http/Requests/InteractsWithRelatedResources.php(39): once(Object(Closure))
#2 /home/newton/git/laravel/nova/galileo/vendor/laravel/nova/src/Http/Requests/InteractsWithRelatedResources.php(49): Laravel\Nova\Http\Requests\NovaRequest->findParentModel()
#3 /home/newton/git/laravel/nova/galileo/vendor/laravel/nova/src/Http/Controllers/ResourceStoreController.php(32): Laravel\Nova\Http\Requests\NovaRequest->findParentModelOrFail()
#4 /home/newton/git/laravel/nova/galileo/vendor/laravel/framework/src/Illuminate/Database/Concerns/ManagesTransactions.php(29): Laravel\Nova\Http\Controllers\ResourceStoreController->Laravel\Nova\Http\Controllers{closure}(Object(Illuminate\Database\MySqlConnection))
#5 /home/newton/git/laravel/nova/galileo/vendor/laravel/framework/src/Illuminate/Database/DatabaseManager.php(349): Illuminate\Database\Connection->transaction(Object(Closure))
#6 /home/newton/git/laravel/nova/galileo/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(261): Illuminate\Database\DatabaseManager->__call('transaction', Array)
#7 /home/newton/git/laravel/nova/galileo/vendor/laravel/nova/src/Http/Controllers/ResourceStoreController.php(44): Illuminate\Support\Facades\Facade::__callStatic('transaction', Array)
#8 [internal function]: Laravel\Nova\Http\Controllers\ResourceStoreController->handle(Object(Laravel\Nova\Http\Requests\CreateResourceRequest), 'pessoas')
#9 /home/newton/git/laravel/nova/galileo/vendor/laravel/framework/src/Illuminate/Routing/Controller.php(54): call_user_func_array(Array, Array)
#10 /home/newton/git/laravel/nova/galileo/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(45): Illuminate\Routing\Controller->callAction('handle', Array)
#11 /home/newton/git/laravel/nova/galileo/vendor/laravel/framework/src/Illuminate/Routing/Route.php(219): Illuminate\Routing\ControllerDispatcher->dispatch(Object(Illuminate\Routing\Route), Object(Laravel\Nova\Http\Controllers\ResourceStoreController), 'handle')
#12 /home/newton/git/laravel/nova/galileo/vendor/laravel/framework/src/Illuminate/Routing/Route.php(176): Illuminate\Routing\Route->runController()
#13 /home/newton/git/laravel/nova/galileo/vendor/laravel/framework/src/Illuminate/Routing/Router.php(681): Illuminate\Routing\Route->run()
#14 /home/newton/git/laravel/nova/galileo/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(130): Illuminate\Routing\Router->Illuminate\Routing{closure}(Object(Illuminate\Http\Request))
#15 /home/newton/git/laravel/nova/galileo/vendor/whitecube/nova-flexible-content/src/Http/Middleware/InterceptFlexibleAttributes.php(27): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#16 /home/newton/git/laravel/nova/galileo/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Whitecube\NovaFlexibleContent\Http\Middleware\InterceptFlexibleAttributes->handle(Object(Illuminate\Http\Request), Object(Closure))
#17 /home/newton/git/laravel/nova/galileo/vendor/laravel/nova/src/Http/Middleware/Authorize.php(18): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#18 /home/newton/git/laravel/nova/galileo/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Laravel\Nova\Http\Middleware\Authorize->handle(Object(Illuminate\Http\Request), Object(Closure))
#19 /home/newton/git/laravel/nova/galileo/vendor/laravel/nova/src/Http/Middleware/BootTools.php(20): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#20 /home/newton/git/laravel/nova/galileo/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Laravel\Nova\Http\Middleware\BootTools->handle(Object(Illuminate\Http\Request), Object(Closure))
#21 /home/newton/git/laravel/nova/galileo/vendor/laravel/nova/src/Http/Middleware/DispatchServingNovaEvent.php(20): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#22 /home/newton/git/laravel/nova/galileo/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Laravel\Nova\Http\Middleware\DispatchServingNovaEvent->handle(Object(Illuminate\Http\Request), Object(Closure))
#23 /home/newton/git/laravel/nova/galileo/vendor/laravel/framework/src/Illuminate/Auth/Middleware/Authenticate.php(43): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#24 /home/newton/git/laravel/nova/galileo/vendor/laravel/nova/src/Http/Middleware/Authenticate.php(31): Illuminate\Auth\Middleware\Authenticate->handle(Object(Illuminate\Http\Request), Object(Closure))
#25 /home/newton/git/laravel/nova/galileo/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Laravel\Nova\Http\Middleware\Authenticate->handle(Object(Illuminate\Http\Request), Object(Closure))
#26 /home/newton/git/laravel/nova/galileo/vendor/laravel/framework/src/Illuminate/Routing/Middleware/SubstituteBindings.php(41): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#27 /home/newton/git/laravel/nova/galileo/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Illuminate\Routing\Middleware\SubstituteBindings->handle(Object(Illuminate\Http\Request), Object(Closure))
#28 /home/newton/git/laravel/nova/galileo/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php(76): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#29 /home/newton/git/laravel/nova/galileo/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Illuminate\Foundation\Http\Middleware\VerifyCsrfToken->handle(Object(Illuminate\Http\Request), Object(Closure))
#30 /home/newton/git/laravel/nova/galileo/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php(49): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#31 /home/newton/git/laravel/nova/galileo/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Illuminate\View\Middleware\ShareErrorsFromSession->handle(Object(Illuminate\Http\Request), Object(Closure))
#32 /home/newton/git/laravel/nova/galileo/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(56): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#33 /home/newton/git/laravel/nova/galileo/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Illuminate\Session\Middleware\StartSession->handle(Object(Illuminate\Http\Request), Object(Closure))
#34 /home/newton/git/laravel/nova/galileo/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php(37): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#35 /home/newton/git/laravel/nova/galileo/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse->handle(Object(Illuminate\Http\Request), Object(Closure))
#36 /home/newton/git/laravel/nova/galileo/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php(66): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#37 /home/newton/git/laravel/nova/galileo/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Illuminate\Cookie\Middleware\EncryptCookies->handle(Object(Illuminate\Http\Request), Object(Closure))
#38 /home/newton/git/laravel/nova/galileo/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(105): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#39 /home/newton/git/laravel/nova/galileo/vendor/laravel/framework/src/Illuminate/Routing/Router.php(683): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#40 /home/newton/git/laravel/nova/galileo/vendor/laravel/framework/src/Illuminate/Routing/Router.php(658): Illuminate\Routing\Router->runRouteWithinStack(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request))
#41 /home/newton/git/laravel/nova/galileo/vendor/laravel/framework/src/Illuminate/Routing/Router.php(624): Illuminate\Routing\Router->runRoute(Object(Illuminate\Http\Request), Object(Illuminate\Routing\Route))
#42 /home/newton/git/laravel/nova/galileo/vendor/laravel/framework/src/Illuminate/Routing/Router.php(613): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request))
#43 /home/newton/git/laravel/nova/galileo/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(170): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request))
#44 /home/newton/git/laravel/nova/galileo/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(130): Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http{closure}(Object(Illuminate\Http\Request))
#45 /home/newton/git/laravel/nova/galileo/vendor/laravel/nova/src/Http/Middleware/ServeNova.php(26): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#46 /home/newton/git/laravel/nova/galileo/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Laravel\Nova\Http\Middleware\ServeNova->handle(Object(Illuminate\Http\Request), Object(Closure))
#47 /home/newton/git/laravel/nova/galileo/vendor/barryvdh/laravel-debugbar/src/Middleware/InjectDebugbar.php(65): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#48 /home/newton/git/laravel/nova/galileo/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Barryvdh\Debugbar\Middleware\InjectDebugbar->handle(Object(Illuminate\Http\Request), Object(Closure))
#49 /home/newton/git/laravel/nova/galileo/vendor/fideloper/proxy/src/TrustProxies.php(57): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#50 /home/newton/git/laravel/nova/galileo/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Fideloper\Proxy\TrustProxies->handle(Object(Illuminate\Http\Request), Object(Closure))
#51 /home/newton/git/laravel/nova/galileo/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#52 /home/newton/git/laravel/nova/galileo/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle(Object(Illuminate\Http\Request), Object(Closure))
#53 /home/newton/git/laravel/nova/galileo/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#54 /home/newton/git/laravel/nova/galileo/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle(Object(Illuminate\Http\Request), Object(Closure))
#55 /home/newton/git/laravel/nova/galileo/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php(27): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#56 /home/newton/git/laravel/nova/galileo/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Illuminate\Foundation\Http\Middleware\ValidatePostSize->handle(Object(Illuminate\Http\Request), Object(Closure))
#57 /home/newton/git/laravel/nova/galileo/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php(63): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#58 /home/newton/git/laravel/nova/galileo/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode->handle(Object(Illuminate\Http\Request), Object(Closure))
#59 /home/newton/git/laravel/nova/galileo/vendor/hyn/multi-tenant/src/Middleware/EagerIdentification.php(29): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#60 /home/newton/git/laravel/nova/galileo/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Hyn\Tenancy\Middleware\EagerIdentification->handle(Object(Illuminate\Http\Request), Object(Closure))
#61 /home/newton/git/laravel/nova/galileo/vendor/hyn/multi-tenant/src/Middleware/HostnameActions.php(75): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#62 /home/newton/git/laravel/nova/galileo/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Hyn\Tenancy\Middleware\HostnameActions->handle(Object(Illuminate\Http\Request), Object(Closure))
#63 /home/newton/git/laravel/nova/galileo/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(105): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#64 /home/newton/git/laravel/nova/galileo/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(145): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#65 /home/newton/git/laravel/nova/galileo/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(110): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(Object(Illuminate\Http\Request))
#66 /home/newton/git/laravel/nova/galileo/public/index.php(55): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request))
#67 /home/newton/.composer/vendor/cpriego/valet-linux/server.php(204): require('/home/newton/gi...')
#68 {main}

@Otienoh
Copy link

Otienoh commented Feb 11, 2020

@davidhemphill @jbrooksuk This issue still exists in Nova 2.10.1 as @newtongamajr has described.

@davidhemphill
Copy link
Contributor

Republish your assets using php artisan nova:publish --force. This was fixed in v2.10.1.

@Otienoh
Copy link

Otienoh commented Feb 11, 2020

Republished my assets using php artisan nova:publish --force issue still persists.

My current fix is to downgrade to Nova 2.9.3 and got it working again

@newtongamajr
Copy link

I did the same as @Otienoh and this issue is still happening on 2.10.1. I've returned to Nova 2.9.4

@IMPMAC
Copy link

IMPMAC commented Feb 11, 2020

I've tested the new version. It works for me on v2.10.1

Perhaps you can clear your browsers cache?

@I3G-Carlos
Copy link

Hello, I had this same problem using:

Laravel 6.2
Nova 2.10.1

I reverted as other people said to nova version 2.9.4 and I still had the same problem. Turns out, the problem was caused by the "chris-ware/nova-breadcrumbs" tool. After disabling it, resource creation works normally. There's an issue open on the tool developer's repository.

@Otienoh
Copy link

Otienoh commented Feb 13, 2020

Possible solutions @I3G-Carlos

@newtongamajr
Copy link

Thanks @Otienoh and @I3G-Carlos , that's exactly the source of this issue.

@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Verified bug by the Nova team
Projects
None yet
Development

No branches or pull requests

6 participants