invoiceninja / invoiceninja

Invoices, Expenses and Tasks built with Laravel, Flutter and React
https://invoiceninja.com
Other
8.02k stars 2.25k forks source link

Migration - trying to get property 'data' of non-object #4989

Closed rndmh3ro closed 3 years ago

rndmh3ro commented 3 years ago

**What version of Invoice Ninja are you running? v4.5.33 / v5.1.10

What environment are you running? ZIP, self-hosted

Have you checked log files (storage/logs/) Please provide redacted output

in v4.5.33:

[2021-02-04 12:12:43] production.INFO: Trying to get property 'data' of non-object [] []                                                                                            

Have you searched existing issues? Yes, I opened a similar issue here: https://github.com/invoiceninja/invoiceninja/issues/4528. However I only got it to work once and since then not anymore.

Have you reported this to Slack/forum before posting? no

Describe the bug The migration fails with the above mentioned error in the logs.

The frontend error says Oops, something went wrong! Please make sure you have setup an Invoice Ninja v5 instance before starting the migration.

Steps To Reproduce Install the above versions and run the migration (without an API key)

Expected behavior Migration works

Screenshots

v5 seems fine: grafik

Additional context Add any other context about the problem here.

turbo124 commented 3 years ago

in storage/migrations you'll want to open up the .zip file and inspect it. It sounds like the migration file didn't get built correctly.

you'll also want to check your V4 logs for any errors.

rndmh3ro commented 3 years ago

There's no zip-file in the migrations folder. And the only log entry is:


[2021-02-25 09:36:25] production.INFO: Trying to get property 'data' of non-object [] []                                                                                            ```
beganovich commented 3 years ago

Can you please post the guide which you followed on installing version 5?

rndmh3ro commented 3 years ago

There's no guide. It is an automated installation in Yunohost, see the script here: https://github.com/YunoHost-Apps/invoiceninja5_ynh/blob/master/scripts/install

As that's a bit dense, I'd be happy to tell you specifics if you tell me what you're looking for.

beganovich commented 3 years ago

Is v5 actually working just fine? Have you gone past the /setup screen?

rndmh3ro commented 3 years ago

Thanks for you rhelp so far!

Is v5 actually working just fine? Have you gone past the /setup screen?

Yes, at least that's what I thought. However there was a problem when I opened invoiceninja without index.php. This did seem to be a problem for the migration (I guess because IN checks the URL during the migration and throws an error if it is not reachable?).

Now I fixed that and there's no error in INv4. However I get an error in INv5 (after turning expanded logging on):


[2021-02-25 19:53:04] production.INFO: Importing account
[2021-02-25 19:53:04] production.INFO: Importing company
[2021-02-25 19:53:05] production.INFO: the path /storage/owkpzet3s6ahaqssor0fup305wr1szfq/tEs6KouGJLr6J838UjKM4sfBeRBzi1qj8Swwmymh.png
[2021-02-25 19:53:05] production.INFO: Importing users
[2021-02-25 19:53:05] production.INFO: Importing payment_terms
[2021-02-25 19:53:05] production.INFO: Importing tax_rates
[2021-02-25 19:53:05] production.INFO: Importing clients
[2021-02-25 19:53:06] production.INFO: Importing company_gateways
[2021-02-25 19:53:06] production.INFO: Importing client_gateway_tokens
[2021-02-25 19:53:06] production.INFO: Importing vendors
[2021-02-25 19:53:06] production.INFO: Importing projects
[2021-02-25 19:53:06] production.INFO: Importing products
[2021-02-25 19:53:06] production.INFO: Importing credits
[2021-02-25 19:53:06] production.INFO: Importing invoices
[2021-02-25 19:53:06] production.INFO: Call to a member function filter() on null
[2021-02-25 19:53:06] production.ERROR: Call to a member function filter() on null {"userId":1,"exception":"[object] (Error(code: 0): Call to a member function filter() on null at /var/www/inv
oiceninja5/app/Models/Client.php:230)
[stacktrace]
#0 /var/www/invoiceninja5/app/Helpers/Invoice/InvoiceItemSum.php(51): App\\Models\\Client->currency()
#1 /var/www/invoiceninja5/app/Helpers/Invoice/InvoiceSum.php(72): App\\Helpers\\Invoice\\InvoiceItemSum->__construct()
#2 /var/www/invoiceninja5/app/Helpers/Invoice/InvoiceSum.php(58): App\\Helpers\\Invoice\\InvoiceSum->calculateLineItems()
#3 /var/www/invoiceninja5/app/Models/Invoice.php(381): App\\Helpers\\Invoice\\InvoiceSum->build()
#4 /var/www/invoiceninja5/app/Repositories/Migration/InvoiceMigrationRepository.php(146): App\\Models\\Invoice->calc()
#5 /var/www/invoiceninja5/app/Jobs/Util/Import.php(737): App\\Repositories\\Migration\\InvoiceMigrationRepository->save()
#6 /var/www/invoiceninja5/app/Jobs/Util/Import.php(206): App\\Jobs\\Util\\Import->processInvoices()
#7 /var/www/invoiceninja5/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): App\\Jobs\\Util\\Import->handle()
#8 /var/www/invoiceninja5/vendor/laravel/framework/src/Illuminate/Container/Util.php(40): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#9 /var/www/invoiceninja5/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\\Container\\Util::unwrapIfClosure()
#10 /var/www/invoiceninja5/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\\Container\\BoundMethod::callBoundMethod()
#11 /var/www/invoiceninja5/vendor/laravel/framework/src/Illuminate/Container/Container.php(610): Illuminate\\Container\\BoundMethod::call()
#12 /var/www/invoiceninja5/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(128): Illuminate\\Container\\Container->call()
#13 /var/www/invoiceninja5/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(128): Illuminate\\Bus\\Dispatcher->Illuminate\\Bus\\{closure}()
#14 /var/www/invoiceninja5/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#15 /var/www/invoiceninja5/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(132): Illuminate\\Pipeline\\Pipeline->then()
#16 /var/www/invoiceninja5/vendor/laravel/framework/src/Illuminate/Foundation/Bus/Dispatchable.php(67): Illuminate\\Bus\\Dispatcher->dispatchNow()
#17 /var/www/invoiceninja5/app/Jobs/Util/StartMigration.php(111): App\\Jobs\\Util\\Import::dispatchNow()
#18 /var/www/invoiceninja5/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): App\\Jobs\\Util\\StartMigration->handle()
#19 /var/www/invoiceninja5/vendor/laravel/framework/src/Illuminate/Container/Util.php(40): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#20 /var/www/invoiceninja5/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\\Container\\Util::unwrapIfClosure()
#21 /var/www/invoiceninja5/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\\Container\\BoundMethod::callBoundMethod()
#22 /var/www/invoiceninja5/vendor/laravel/framework/src/Illuminate/Container/Container.php(610): Illuminate\\Container\\BoundMethod::call()
#23 /var/www/invoiceninja5/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(128): Illuminate\\Container\\Container->call()
#24 /var/www/invoiceninja5/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(128): Illuminate\\Bus\\Dispatcher->Illuminate\\Bus\\{closure}()
#25 /var/www/invoiceninja5/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#26 /var/www/invoiceninja5/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(132): Illuminate\\Pipeline\\Pipeline->then()
#27 /var/www/invoiceninja5/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(118): Illuminate\\Bus\\Dispatcher->dispatchNow()
#28 /var/www/invoiceninja5/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(128): Illuminate\\Queue\\CallQueuedHandler->Illuminate\\Queue\\{closure}()
#29 /var/www/invoiceninja5/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#30 /var/www/invoiceninja5/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(120): Illuminate\\Pipeline\\Pipeline->then()
#31 /var/www/invoiceninja5/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(70): Illuminate\\Queue\\CallQueuedHandler->dispatchThroughMiddleware()
#32 /var/www/invoiceninja5/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php(98): Illuminate\\Queue\\CallQueuedHandler->call()
#33 /var/www/invoiceninja5/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(406): Illuminate\\Queue\\Jobs\\Job->fire()
#34 /var/www/invoiceninja5/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(356): Illuminate\\Queue\\Worker->process()
#35 /var/www/invoiceninja5/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(158): Illuminate\\Queue\\Worker->runJob()
#36 /var/www/invoiceninja5/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(116): Illuminate\\Queue\\Worker->daemon()
#37 /var/www/invoiceninja5/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(100): Illuminate\\Queue\\Console\\WorkCommand->runWorker()
#38 /var/www/invoiceninja5/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Illuminate\\Queue\\Console\\WorkCommand->handle()
#39 /var/www/invoiceninja5/vendor/laravel/framework/src/Illuminate/Container/Util.php(40): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#40 /var/www/invoiceninja5/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\\Container\\Util::unwrapIfClosure()
#41 /var/www/invoiceninja5/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\\Container\\BoundMethod::callBoundMethod()
#42 /var/www/invoiceninja5/vendor/laravel/framework/src/Illuminate/Container/Container.php(610): Illuminate\\Container\\BoundMethod::call()
#43 /var/www/invoiceninja5/vendor/laravel/framework/src/Illuminate/Console/Command.php(136): Illuminate\\Container\\Container->call()
#44 /var/www/invoiceninja5/vendor/symfony/console/Command/Command.php(256): Illuminate\\Console\\Command->execute()
#45 /var/www/invoiceninja5/vendor/laravel/framework/src/Illuminate/Console/Command.php(121): Symfony\\Component\\Console\\Command\\Command->run()
#46 /var/www/invoiceninja5/vendor/symfony/console/Application.php(971): Illuminate\\Console\\Command->run()
#47 /var/www/invoiceninja5/vendor/symfony/console/Application.php(290): Symfony\\Component\\Console\\Application->doRunCommand()
#48 /var/www/invoiceninja5/vendor/symfony/console/Application.php(166): Symfony\\Component\\Console\\Application->doRun()
#49 /var/www/invoiceninja5/vendor/laravel/framework/src/Illuminate/Console/Application.php(93): Symfony\\Component\\Console\\Application->run()
#50 /var/www/invoiceninja5/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(129): Illuminate\\Console\\Application->run()
#51 /var/www/invoiceninja5/artisan(37): Illuminate\\Foundation\\Console\\Kernel->handle()
#52 {main}
"}
turbo124 commented 3 years ago

It looks like your app hasn't completed the initial setup caching.

You may want to try appending ?clear_cache=true to your V5 url and refresh the page, this should build the cache

rndmh3ro commented 3 years ago

I did that and now I get another exception:

[2021-02-26 12:02:39] production.INFO: Importing documents                                                                                                                          
[2021-02-26 12:02:39] production.INFO: App\Models\User::name must return a relationship instance.                                                                                   
[2021-02-26 12:02:40] production.ERROR: App\Models\User::name must return a relationship instance. {"userId":1,"exception":"[object] (LogicException(code: 0): App\\Models\\User::name must return a relationship instance. at /var/www/invoiceninja5/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php:464)
[stacktrace]                                                                                                                                                                        
#0 /var/www/invoiceninja5/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php(441): Illuminate\\Database\\Eloquent\\Model->getRelationshipFromMetho
d()
#1 /var/www/invoiceninja5/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php(396): Illuminate\\Database\\Eloquent\\Model->getRelationValue()      
#2 /var/www/invoiceninja5/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(1809): Illuminate\\Database\\Eloquent\\Model->getAttribute()                          
#3 /var/www/invoiceninja5/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(1854): Illuminate\\Database\\Eloquent\\Model->offsetExists()                          
#4 /var/www/invoiceninja5/vendor/laravel/framework/src/Illuminate/Mail/Mailable.php(620): Illuminate\\Database\\Eloquent\\Model->__isset()                                          
#5 /var/www/invoiceninja5/vendor/laravel/framework/src/Illuminate/Mail/Mailable.php(517): Illuminate\\Mail\\Mailable->setAddress()                                                  
#6 /var/www/invoiceninja5/vendor/laravel/framework/src/Illuminate/Mail/PendingMail.php(155): Illuminate\\Mail\\Mailable->to()                                                       
#7 /var/www/invoiceninja5/vendor/laravel/framework/src/Illuminate/Mail/PendingMail.php(121): Illuminate\\Mail\\PendingMail->fill()                                                  
#8 /var/www/invoiceninja5/app/Jobs/Util/Import.php(218): Illuminate\\Mail\\PendingMail->send()                                                                                      
#9 /var/www/invoiceninja5/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): App\\Jobs\\Util\\Import->handle()                                                  
#10 /var/www/invoiceninja5/vendor/laravel/framework/src/Illuminate/Container/Util.php(40): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()                   
#11 /var/www/invoiceninja5/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\\Container\\Util::unwrapIfClosure()                                    
#12 /var/www/invoiceninja5/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\\Container\\BoundMethod::callBoundMethod()                             
#13 /var/www/invoiceninja5/vendor/laravel/framework/src/Illuminate/Container/Container.php(610): Illuminate\\Container\\BoundMethod::call()                                         
#14 /var/www/invoiceninja5/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(128): Illuminate\\Container\\Container->call()                                                
#15 /var/www/invoiceninja5/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(128): Illuminate\\Bus\\Dispatcher->Illuminate\\Bus\\{closure}()                            
#16 /var/www/invoiceninja5/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()                    
#17 /var/www/invoiceninja5/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(132): Illuminate\\Pipeline\\Pipeline->then()                                                  
#18 /var/www/invoiceninja5/vendor/laravel/framework/src/Illuminate/Foundation/Bus/Dispatchable.php(67): Illuminate\\Bus\\Dispatcher->dispatchNow()                                  
#19 /var/www/invoiceninja5/app/Jobs/Util/StartMigration.php(111): App\\Jobs\\Util\\Import::dispatchNow()                                                                            
#20 /var/www/invoiceninja5/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): App\\Jobs\\Util\\StartMigration->handle()                                         
#21 /var/www/invoiceninja5/vendor/laravel/framework/src/Illuminate/Container/Util.php(40): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()                   
#22 /var/www/invoiceninja5/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\\Container\\Util::unwrapIfClosure()
#23 /var/www/invoiceninja5/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\\Container\\BoundMethod::callBoundMethod()
#24 /var/www/invoiceninja5/vendor/laravel/framework/src/Illuminate/Container/Container.php(610): Illuminate\\Container\\BoundMethod::call()
#25 /var/www/invoiceninja5/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(128): Illuminate\\Container\\Container->call()
#26 /var/www/invoiceninja5/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(128): Illuminate\\Bus\\Dispatcher->Illuminate\\Bus\\{closure}()
#27 /var/www/invoiceninja5/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#28 /var/www/invoiceninja5/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(132): Illuminate\\Pipeline\\Pipeline->then()
#29 /var/www/invoiceninja5/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(118): Illuminate\\Bus\\Dispatcher->dispatchNow()
#30 /var/www/invoiceninja5/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(128): Illuminate\\Queue\\CallQueuedHandler->Illuminate\\Queue\\{closure}()
#31 /var/www/invoiceninja5/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#32 /var/www/invoiceninja5/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(120): Illuminate\\Pipeline\\Pipeline->then()
#33 /var/www/invoiceninja5/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(70): Illuminate\\Queue\\CallQueuedHandler->dispatchThroughMiddleware()
#34 /var/www/invoiceninja5/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php(98): Illuminate\\Queue\\CallQueuedHandler->call()
#35 /var/www/invoiceninja5/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(406): Illuminate\\Queue\\Jobs\\Job->fire()
#36 /var/www/invoiceninja5/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(356): Illuminate\\Queue\\Worker->process()
#37 /var/www/invoiceninja5/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(158): Illuminate\\Queue\\Worker->runJob()
#38 /var/www/invoiceninja5/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(116): Illuminate\\Queue\\Worker->daemon()
#39 /var/www/invoiceninja5/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(100): Illuminate\\Queue\\Console\\WorkCommand->runWorker()
#40 /var/www/invoiceninja5/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Illuminate\\Queue\\Console\\WorkCommand->handle()
#41 /var/www/invoiceninja5/vendor/laravel/framework/src/Illuminate/Container/Util.php(40): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#42 /var/www/invoiceninja5/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\\Container\\Util::unwrapIfClosure()
#43 /var/www/invoiceninja5/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\\Container\\BoundMethod::callBoundMethod()
#44 /var/www/invoiceninja5/vendor/laravel/framework/src/Illuminate/Container/Container.php(610): Illuminate\\Container\\BoundMethod::call()
#45 /var/www/invoiceninja5/vendor/laravel/framework/src/Illuminate/Console/Command.php(136): Illuminate\\Container\\Container->call()
#46 /var/www/invoiceninja5/vendor/symfony/console/Command/Command.php(256): Illuminate\\Console\\Command->execute()
#47 /var/www/invoiceninja5/vendor/laravel/framework/src/Illuminate/Console/Command.php(121): Symfony\\Component\\Console\\Command\\Command->run()
#48 /var/www/invoiceninja5/vendor/symfony/console/Application.php(971): Illuminate\\Console\\Command->run()
#49 /var/www/invoiceninja5/vendor/symfony/console/Application.php(290): Symfony\\Component\\Console\\Application->doRunCommand()
#50 /var/www/invoiceninja5/vendor/symfony/console/Application.php(166): Symfony\\Component\\Console\\Application->doRun()
#51 /var/www/invoiceninja5/vendor/laravel/framework/src/Illuminate/Console/Application.php(93): Symfony\\Component\\Console\\Application->run()
#52 /var/www/invoiceninja5/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(129): Illuminate\\Console\\Application->run()
#53 /var/www/invoiceninja5/artisan(37): Illuminate\\Foundation\\Console\\Kernel->handle()
#54 {main}"}

Interestingly the license seems to have been migrated. However nothing else shows up.

turbo124 commented 3 years ago

I think i see the issue, i will push a fix up for this.

Please note, the migration looks to be successful (you will need to switch companies in the UI to see your imported data)

The error defined here is only for the final migration email.

turbo124 commented 3 years ago

5000

rndmh3ro commented 3 years ago

Thanks, now it's working! Awesome product and awesome team!