PDF generation broken?

I am using IN 4.4.1 (updated via your recommended script automatically) - and since a few days the PDF generation is broken; i just see a grey box instead of the PDF.
I did a “composer install” again, and found a few warnings like

Warning: Ambiguous class resolution, "ZendService\Google\Gcm\Client" was found in both "/var/www/virtual/nerdocs/invoice-ninja/vendor/zendframework/zendservice-google-gcm/library/ZendService/Google/Gcm/Client.php" and "/var/www/virtual/nerdocs/invoice-ninja/vendor/zendframework/zendservice-google-gcm/library/Gcm/Client.php", the first will be used.
Warning: Ambiguous class resolution, "ZendService\Google\Gcm\Response" was found in both "/var/www/virtual/nerdocs/invoice-ninja/vendor/zendframework/zendservice-google-gcm/library/ZendService/Google/Gcm/Response.php" and "/var/www/virtual/nerdocs/invoice-ninja/vendor/zendframework/zendservice-google-gcm/library/Gcm/Response.php", the first will be used.
Warning: Ambiguous class resolution, "ZendService\Google\Gcm\Message" was found in both "/var/www/virtual/nerdocs/invoice-ninja/vendor/zendframework/zendservice-google-gcm/library/ZendService/Google/Gcm/Message.php" and "/var/www/virtual/nerdocs/invoice-ninja/vendor/zendframework/zendservice-google-gcm/library/Gcm/Message.php", the first will be used.
Warning: Ambiguous class resolution, "ZendService\Google\Exception\RuntimeException" was found in both "/var/www/virtual/nerdocs/invoice-ninja/vendor/zendframework/zendservice-google-gcm/library/ZendService/Google/Exception/RuntimeException.php" and "/var/www/virtual/nerdocs/invoice-ninja/vendor/zendframework/zendservice-google-gcm/library/Exception/RuntimeException.php", the first will be used.
Warning: Ambiguous class resolution, "ZendService\Google\Exception\InvalidArgumentException" was found in both "/var/www/virtual/nerdocs/invoice-ninja/vendor/zendframework/zendservice-google-gcm/library/ZendService/Google/Exception/InvalidArgumentException.php" and "/var/www/virtual/nerdocs/invoice-ninja/vendor/zendframework/zendservice-google-gcm/library/Exception/InvalidArgumentException.php", the first will be used.
Warning: Ambiguous class resolution, "GPBMetadata\Google\Protobuf\FieldMask" was found in both "/var/www/virtual/nerdocs/invoice-ninja/vendor/google/protobuf/php/src/GPBMetadata/Google/Protobuf/FieldMask.php" and "/var/www/virtual/nerdocs/invoice-ninja/vendor/google/gax/metadata/Protobuf/FieldMask.php", the first will be used.
Warning: Ambiguous class resolution, "GPBMetadata\Google\Protobuf\Wrappers" was found in both "/var/www/virtual/nerdocs/invoice-ninja/vendor/google/protobuf/php/src/GPBMetadata/Google/Protobuf/Wrappers.php" and "/var/www/virtual/nerdocs/invoice-ninja/vendor/google/gax/metadata/Protobuf/Wrappers.php", the first will be used.
Warning: Ambiguous class resolution, "GPBMetadata\Google\Protobuf\GPBEmpty" was found in both "/var/www/virtual/nerdocs/invoice-ninja/vendor/google/protobuf/php/src/GPBMetadata/Google/Protobuf/GPBEmpty.php" and "/var/www/virtual/nerdocs/invoice-ninja/vendor/google/gax/metadata/Protobuf/GPBEmpty.php", the first will be used.
Warning: Ambiguous class resolution, "GPBMetadata\Google\Protobuf\Api" was found in both "/var/www/virtual/nerdocs/invoice-ninja/vendor/google/protobuf/php/src/GPBMetadata/Google/Protobuf/Api.php" and "/var/www/virtual/nerdocs/invoice-ninja/vendor/google/gax/metadata/Protobuf/Api.php", the first will be used.
Warning: Ambiguous class resolution, "GPBMetadata\Google\Protobuf\Timestamp" was found in both "/var/www/virtual/nerdocs/invoice-ninja/vendor/google/protobuf/php/src/GPBMetadata/Google/Protobuf/Timestamp.php" and "/var/www/virtual/nerdocs/invoice-ninja/vendor/google/gax/metadata/Protobuf/Timestamp.php", the first will be used.
Warning: Ambiguous class resolution, "GPBMetadata\Google\Protobuf\SourceContext" was found in both "/var/www/virtual/nerdocs/invoice-ninja/vendor/google/protobuf/php/src/GPBMetadata/Google/Protobuf/SourceContext.php" and "/var/www/virtual/nerdocs/invoice-ninja/vendor/google/gax/metadata/Protobuf/SourceContext.php", the first will be used.
Warning: Ambiguous class resolution, "GPBMetadata\Google\Protobuf\Duration" was found in both "/var/www/virtual/nerdocs/invoice-ninja/vendor/google/protobuf/php/src/GPBMetadata/Google/Protobuf/Duration.php" and "/var/www/virtual/nerdocs/invoice-ninja/vendor/google/gax/metadata/Protobuf/Duration.php", the first will be used.
Warning: Ambiguous class resolution, "GPBMetadata\Google\Protobuf\Any" was found in both "/var/www/virtual/nerdocs/invoice-ninja/vendor/google/protobuf/php/src/GPBMetadata/Google/Protobuf/Any.php" and "/var/www/virtual/nerdocs/invoice-ninja/vendor/google/gax/metadata/Protobuf/Any.php", the first will be used.
Warning: Ambiguous class resolution, "GPBMetadata\Google\Protobuf\Type" was found in both "/var/www/virtual/nerdocs/invoice-ninja/vendor/google/protobuf/php/src/GPBMetadata/Google/Protobuf/Type.php" and "/var/www/virtual/nerdocs/invoice-ninja/vendor/google/gax/metadata/Protobuf/Type.php", the first will be used.
Warning: Ambiguous class resolution, "GPBMetadata\Google\Protobuf\Struct" was found in both "/var/www/virtual/nerdocs/invoice-ninja/vendor/google/protobuf/php/src/GPBMetadata/Google/Protobuf/Struct.php" and "/var/www/virtual/nerdocs/invoice-ninja/vendor/google/gax/metadata/Protobuf/Struct.php", the first will be used.

Is there anything I can do? What information do you need to help me fix this / how can I help?

From: Ambiguous class resolution is different between default and optimized autoloader-creation · Issue #5849 · composer/composer · GitHub

As workaround I’ve executed rm -rf vendors and run composer install

Ok, thanks, the warnings now are gone, but my PDF canvas is still grey. clear_cache did not help neither. I’m stuck here.

What do you see on /update

Oh. this is strange.


SQLSTATE[HY000]: General error: 1005 Can't create table 'snip_ninja.#sql-7e1_127343c' (errno: 121) (SQL: alter table <code>activities</code> add constraint <code>activities_client_id_foreign</code> foreign key (<code>client_id</code>) references <code>clients</code> (<code>id</code>) on delete cascade)

This should not happen, as I cave all rights on that database.

Have you manually deleted any clients from your database?

You can check with this SQL query:


select a.id, a.created_at, a.client_id
from activities a 
left join clients c on c.id = a.client_id
where c.id is null
and a.client_id is not null;

If there are matching records you’ll need to delete them and then load /update.

“No rows.”
And I did not delete any clients…

Try commenting out lines 16 to 72 in the following file and then load /update.

database/migrations/2018_03_08_150414_add_slack_notifications.php

tataaaaaaa - it worked. You’re a genius.
Hm - how can I prevent this problem to happen again on the next (daily) update?
The code gets overwritten (and commented-in again) with the next update…

Great to hear!

This particular problem shouldn’t happen again, once the migration completes the code is no longer used.

I’m having the same issue. The PDF is generated but it the pdf reader tells me it is damaged.

When I’m running /update I’m getting a different error:

is_executable(): open_basedir restriction in effect. File(/opt/plesk/php/7.1/bin/php) is not within the allowed path(s): (/var/www/vhosts/domain.nl/:/tmp/)

A common error with shared hosting is “open_basedir restriction in effect”, if you see this you’ll need to either temporarily modify your open_basedir settings or run the update from the command line.

http://docs.invoiceninja.com/en/latest/update.html

What should my open_basedir setting be?

You can either temporarily disable it or add the path, you may want to follow up with your web host for help.

Oke, so I added the path to my open_basedir setting. Now I also removed my vendor folder and run composer install again. Now I’m getting a huge load of warnings, 872 to be exactly!!! All errors like this:

Warning: Ambiguous class resolution, "AddCustomContactFields" was found in both "/var/www/vhosts/domain.nl/facturen.domain.nl/database/migrations/2017_04_16_101744_add_custom_contact_fields.php" and "/var/www/vhosts/domain.nl/facturen.domain.nl/database/database/migrations/2017_04_16_101744_add_custom_contact_fields.php", the first will be used.
Warning: Ambiguous class resolution, "AddSwapPostalCode" was found in both "/var/www/vhosts/domain.nl/facturen.domain.nl/database/migrations/2015_09_04_080604_add_swap_postal_code.php" and "/var/www/vhosts/domain.nl/facturen.domain.nl/database/database/migrations/2015_09_04_080604_add_swap_postal_code.php", the first will be used.
Warning: Ambiguous class resolution, "AddDanishTranslation" was found in both "/var/www/vhosts/domain.nl/facturen.domain.nl/database/migrations/2014_10_14_225227_add_danish_translation.php" and "/var/www/vhosts/domain.nl/facturen.domain.nl/database/database/migrations/2014_10_14_225227_add_danish_translation.php", the first will be used.
Warning: Ambiguous class resolution, "AddCascaseDrops" was found in both "/var/www/vhosts/domain.nl/facturen.domain.nl/database/migrations/2014_02_13_151500_add_cascase_drops.php" and "/var/www/vhosts/domain.nl/facturen.domain.nl/database/database/migrations/2014_02_13_151500_add_cascase_drops.php", the first will be used.
Warning: Ambiguous class resolution, "AddInvoiceFontSupport" was found in both "/var/www/vhosts/domain.nl/facturen.domain.nl/database/migrations/2016_01_06_153144_add_invoice_font_support.php" and "/var/www/vhosts/domain.nl/facturen.domain.nl/database/database/migrations/2016_01_06_153144_add_invoice_font_support.php", the first will be used.

Running /update is going fine by te way. But when I now go to an invoice, I’m getting an error.

(1/1) FatalThrowableError
Call to undefined method App\Ninja\Presenters\AccountPresenter::customLabel()

Oke, I think I fixed all issues.

I’ve downloaded the code, uploaded this run /update an now everything seems to be working again.

Happy to hear it!