Open jayavman opened 1 month ago
Do you have any existing status labels, and if not, are you including status labels in your import? What's on line 24 of that file for you?
The requested URL was not found on this server.
Also, what is the url it says it can't find? I can't reproduce this locally.
Its not the file because I cant even delete previous bulk uploads
[2024-06-21 21:59:15] production.ERROR: ErrorException: Attempt to read property "id" on null in /home/fredons/public_html/asset/app/Importer/AssetImporter.php:24#50 /home/fredons/public_html/asset/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(175): Illuminate\Pipeline\Pipeline->then(Object(Closure))
"}
Hey @snipe
Issue is because its going to : /livewire/update
we use a longer path eg. www,test.com/test/123/livewire/update
its going to www.test.com/livewire/update
We haven't made any changes to that in quite some time. I'll take a look and see if I can reproduce, but as I've said for a decade, Snipe-IT really doesn't want to be run in a subdirectory. We've done a lot of work to make that less awful, but we're fighting against the framework at this point.
It would have been something that has changed in the last 2 weeks as i update its frequently and it worked fine 2 weeks ago
I'm fairly certain we didn't make any changes to the importer within the last two weeks, but I'm still looking into this for you.
@snipe v7.0.7 was tagged within the last two weeks and included the Livewire v3 update which the importer uses...
@jayavman do you remember if you successfully imported while using v7.0.0-v7.0.6 by any chance?
I'll look into it.
@jayavman I don't have the ability to easily run the app in a subdirectory. Would you be ok trying something out to see if it fixes the issue?
Can you add the following to the bottom of the AppServiceProvider
's boot
method under Setting::observe(SettingObserver::class);
\Livewire\Livewire::setUpdateRoute(function ($handle) {
return \Illuminate\Support\Facades\Route::post('/custom/livewire/update', $handle);
});
\Livewire\Livewire::setScriptRoute(function ($handle) {
return \Illuminate\Support\Facades\Route::get('/custom/livewire/livewire.js', $handle);
});
but change /custom/livewire/update
to /{your_longer_path}/livewire/update
.
After that change can you attempt to update/process/delete old import files and let me know if it works?
Future reference for myself: the docs for the custom url stuff is here.
\Livewire\Livewire::setUpdateRoute(function ($handle) { return \Illuminate\Support\Facades\Route::post('/custom/livewire/update', $handle); }); \Livewire\Livewire::setScriptRoute(function ($handle) { return \Illuminate\Support\Facades\Route::get('/custom/livewire/livewire.js', $handle); });
Worked perfectly! that was the problem. Will i need to do this everytime an update comes now?
@jayavman glad it worked! I'll make it a setting you can drop in your env.
@jayavman this should be handled in #15073 and only require you to add LIVEWIRE_URL_PREFIX={your path prefix}
to your .env file (if and once the PR is merged)
Debug mode
Describe the bug
This error is only new.
When uploading Csv, or even deleting it from the Import list comes up with Production.ERROR: ErrorException: Attempt to read property "id" on null in /home/fredons/public_html/asset/app/Importer/AssetImporter.php:24#50 /home/fredons/public_html/asset/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(175): Illuminate\Pipeline\Pipeline->then(Object(Closure))
51 /home/fredons/public_html/asset/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(144): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(Object(Illuminate\Http\Request))
52 /home/fredons/public_html/asset/public/index.php(52): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request))
53 {main}
"}
its giving me a Not Found
The requested URL was not found on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
Reproduction steps
Go to Import and import csv.
Expected behavior
no error when importing or deleting file.
Screenshots
[2024-06-21 21:59:15] production.ERROR: Attempt to read property "id" on null {"userId":1,"exception":"[object] (ErrorException(code: 0): Attempt to read property \"id\" on null at /home/fredons/public_html/asset/app/Importer/AssetImporter.php:24) Stack trace:
0 /home/fredons/public_html/asset/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(255): Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(2, 'Attempt to read...', '/home/fredons/p...', 24)
1 /home/fredons/public_html/asset/app/Importer/AssetImporter.php(24): Illuminate\Foundation\Bootstrap\HandleExceptions->Illuminate\Foundation\Bootstrap{closure}(2, 'Attempt to read...', '/home/fredons/p...', 24)
2 /home/fredons/public_html/asset/app/Http/Requests/ItemImportRequest.php(43): App\Importer\AssetImporter->__construct('/home/fredons/p...')
3 /home/fredons/public_html/asset/app/Http/Controllers/Api/ImportController.php(176): App\Http\Requests\ItemImportRequest->import(Object(App\Models\Import))
4 /home/fredons/public_html/asset/vendor/laravel/framework/src/Illuminate/Routing/Controller.php(54): App\Http\Controllers\Api\ImportController->process(Object(App\Http\Requests\ItemImportRequest), '100')
5 /home/fredons/public_html/asset/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(43): Illuminate\Routing\Controller->callAction('process', Array)
6 /home/fredons/public_html/asset/vendor/laravel/framework/src/Illuminate/Routing/Route.php(260): Illuminate\Routing\ControllerDispatcher->dispatch(Object(Illuminate\Routing\Route), Object(App\Http\Controllers\Api\ImportController), 'process')
7 /home/fredons/public_html/asset/vendor/laravel/framework/src/Illuminate/Routing/Route.php(205): Illuminate\Routing\Route->runController()
8 /home/fredons/public_html/asset/vendor/laravel/framework/src/Illuminate/Routing/Router.php(806): Illuminate\Routing\Route->run()
9 /home/fredons/public_html/asset/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(144): Illuminate\Routing\Router->Illuminate\Routing{closure}(Object(Illuminate\Http\Request))
10 /home/fredons/public_html/asset/vendor/laravel/framework/src/Illuminate/Routing/Middleware/ThrottleRequests.php(159): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
11 /home/fredons/public_html/asset/vendor/laravel/framework/src/Illuminate/Routing/Middleware/ThrottleRequests.php(135): Illuminate\Routing\Middleware\ThrottleRequests->handleRequest(Object(Illuminate\Http\Request), Object(Closure), Array)
12 /home/fredons/public_html/asset/vendor/laravel/framework/src/Illuminate/Routing/Middleware/ThrottleRequests.php(87): Illuminate\Routing\Middleware\ThrottleRequests->handleRequestUsingNamedLimiter(Object(Illuminate\Http\Request), Object(Closure), 'api', Object(Closure))
13 /home/fredons/public_html/asset/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\Routing\Middleware\ThrottleRequests->handle(Object(Illuminate\Http\Request), Object(Closure), 'api')
14 /home/fredons/public_html/asset/vendor/laravel/framework/src/Illuminate/Auth/Middleware/Authenticate.php(57): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
15 /home/fredons/public_html/asset/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\Auth\Middleware\Authenticate->handle(Object(Illuminate\Http\Request), Object(Closure), 'api')
16 /home/fredons/public_html/asset/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(119): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
17 /home/fredons/public_html/asset/vendor/laravel/framework/src/Illuminate/Routing/Router.php(807): Illuminate\Pipeline\Pipeline->then(Object(Closure))
18 /home/fredons/public_html/asset/vendor/laravel/framework/src/Illuminate/Routing/Router.php(784): Illuminate\Routing\Router->runRouteWithinStack(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request))
19 /home/fredons/public_html/asset/vendor/laravel/framework/src/Illuminate/Routing/Router.php(748): Illuminate\Routing\Router->runRoute(Object(Illuminate\Http\Request), Object(Illuminate\Routing\Route))
20 /home/fredons/public_html/asset/vendor/laravel/framework/src/Illuminate/Routing/Router.php(737): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request))
21 /home/fredons/public_html/asset/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(200): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request))
22 /home/fredons/public_html/asset/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(144): Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http{closure}(Object(Illuminate\Http\Request))
23 /home/fredons/public_html/asset/vendor/livewire/livewire/src/DisableBrowserCache.php(19): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
24 /home/fredons/public_html/asset/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Livewire\DisableBrowserCache->handle(Object(Illuminate\Http\Request), Object(Closure))
25 /home/fredons/public_html/asset/vendor/barryvdh/laravel-debugbar/src/Middleware/InjectDebugbar.php(59): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
26 /home/fredons/public_html/asset/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Barryvdh\Debugbar\Middleware\InjectDebugbar->handle(Object(Illuminate\Http\Request), Object(Closure))
27 /home/fredons/public_html/asset/vendor/laravel/framework/src/Illuminate/Http/Middleware/HandleCors.php(62): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
28 /home/fredons/public_html/asset/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\Http\Middleware\HandleCors->handle(Object(Illuminate\Http\Request), Object(Closure))
29 /home/fredons/public_html/asset/app/Http/Middleware/PreventBackHistory.php(23): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
30 /home/fredons/public_html/asset/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): App\Http\Middleware\PreventBackHistory->handle(Object(Illuminate\Http\Request), Object(Closure))
31 /home/fredons/public_html/asset/app/Http/Middleware/SecurityHeaders.php(26): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
32 /home/fredons/public_html/asset/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): App\Http\Middleware\SecurityHeaders->handle(Object(Illuminate\Http\Request), Object(Closure))
33 /home/fredons/public_html/asset/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
34 /home/fredons/public_html/asset/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ConvertEmptyStringsToNull.php(31): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle(Object(Illuminate\Http\Request), Object(Closure))
35 /home/fredons/public_html/asset/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull->handle(Object(Illuminate\Http\Request), Object(Closure))
36 /home/fredons/public_html/asset/app/Http/Middleware/CheckForDebug.php(25): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
37 /home/fredons/public_html/asset/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): App\Http\Middleware\CheckForDebug->handle(Object(Illuminate\Http\Request), Object(Closure))
38 /home/fredons/public_html/asset/app/Http/Middleware/CheckForSetup.php(25): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
39 /home/fredons/public_html/asset/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): App\Http\Middleware\CheckForSetup->handle(Object(Illuminate\Http\Request), Object(Closure))
40 /home/fredons/public_html/asset/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php(49): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
41 /home/fredons/public_html/asset/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\View\Middleware\ShareErrorsFromSession->handle(Object(Illuminate\Http\Request), Object(Closure))
42 /home/fredons/public_html/asset/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(121): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
43 /home/fredons/public_html/asset/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(64): Illuminate\Session\Middleware\StartSession->handleStatefulRequest(Object(Illuminate\Http\Request), Object(Illuminate\Session\Store), Object(Closure))
44 /home/fredons/public_html/asset/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\Session\Middleware\StartSession->handle(Object(Illuminate\Http\Request), Object(Closure))
45 /home/fredons/public_html/asset/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/PreventRequestsDuringMaintenance.php(99): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
46 /home/fredons/public_html/asset/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance->handle(Object(Illuminate\Http\Request), Object(Closure))
47 /home/fredons/public_html/asset/app/Http/Middleware/NoSessionStore.php(28): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
48 /home/fredons/public_html/asset/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): App\Http\Middleware\NoSessionStore->handle(Object(Illuminate\Http\Request), Object(Closure))
49 /home/fredons/public_html/asset/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(119): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
50 /home/fredons/public_html/asset/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(175): Illuminate\Pipeline\Pipeline->then(Object(Closure))
51 /home/fredons/public_html/asset/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(144): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(Object(Illuminate\Http\Request))
52 /home/fredons/public_html/asset/public/index.php(52): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request))
53 {main}
Snipe-IT Version
v7.0.7 build 14172 (ge50296870)
Operating System
AlmaLinux v9.3.0
Web Server
apache
PHP Version
8.1.29
Operating System
No response
Browser
No response
Version
No response
Device
No response
Operating System
No response
Browser
No response
Version
No response
Error messages
No response
Additional context
No response