PrestaShopCorp / ps_mbo

Pushes modules from the Addons Marketplace
Academic Free License v3.0
20 stars 19 forks source link

setDefaultParams() must be of the type string #754

Closed afxgroup closed 4 months ago

afxgroup commented 5 months ago

I've updated ps_mbo to the latest version available for prestashop 1.7.8 and now the admin panel doesn't work anymore. I get this error:

PrestaShop\Module\Mbo\Addons\ApiClient::setDefaultParams() must be of the type string, null given, called in appProdProjectContainer.php on line 3494

And the only way to enter in backoffice is to delete the module from db, delete the cache and force AdminModulesCatalog as controller in marketplace. Any hint?

intraordinaire commented 5 months ago

Hello @afxgroup,

Thanks for your feedback.

The class PrestaShop\Module\Mbo\Addons\ApiClient is instantiated through Symfony services, and maybe something is missing or is not well initialized before the call.

https://github.com/PrestaShopCorp/ps_mbo/blob/11daf498405de04f3b9ff145bb0fb673f1c86e40/config/services/addons.yml#L7

- method: setDefaultParams
        arguments:
          - "@=service('translator').getLocale()"
          - "@=service('prestashop.adapter.data_provider.country').getIsoCodebyId()"
          - "@=service('prestashop.adapter.legacy.configuration').get('_PS_BASE_URL_')"
          - "@=service('prestashop.core.foundation.version').getSemVersion()"

Some questions :

In the meantime, we try to reproduce it.

afxgroup commented 5 months ago

Yes, i've cleared the cache several times of course

PHP version 7.4.33 on nginx

This is my addons.yml:


  _defaults:
    public: true

  # Addons API Client
  mbo.addons.client.api:
    class: PrestaShop\Module\Mbo\Addons\ApiClient
    arguments:
      - "@mbo.addons.client.http"
    calls:
      - method: setDefaultParams
        arguments:
          - "@=service('translator').getLocale()"
          - "@=service('prestashop.adapter.data_provider.country').getIsoCodebyId()"
          - "@=service('prestashop.adapter.legacy.configuration').get('_PS_BASE_URL_')"
          - "@=service('prestashop.core.foundation.version').getSemVersion()"```

It seems upgraded from version 2.33 (if I remember correctly) to 3.1.1
intraordinaire commented 5 months ago

Thanks !

Strange behavior, we are trying to reproduce or search how this can happen.

intraordinaire commented 5 months ago

@afxgroup We tried to reproduce it, but with no success :(

https://github.com/PrestaShopCorp/ps_mbo/assets/1721887/5c677828-313b-47eb-b3f8-be0daca4d49f

Can you try to dump somewhere the values of the needed arguments ?

intraordinaire commented 4 months ago

As we don't have any news, I close the issue.

Feel free to reopen it if needed, or open another if you find something else.

Thanks !

intraordinaire commented 1 month ago

Hello @afxgroup

Very long time ago, you opened this bug, and we unfortunately did not find a solution.

But today, we found the root cause.

Your user in back-office (table ps_employee) may have a value in id_lang that was not present in the table ps_lang. So the default param @=service('translator').getLocale() was null.

Some other features in the BO should not have worked as expected in this case (maybe silent errors, less visible).

afxgroup commented 1 month ago

Thanks for reply i've checked the languages and the problem was in a language no more in DB However i get this error now on Marketplace:

Oh no.. something went wrong There has been a problem on our side. Refresh your page and if the problem persists, try again later.

While: Modules in the spotlight] Has no problem

intraordinaire commented 1 month ago

@afxgroup

You can try to reset the module, maybe, the language problem causes another problem on the installation process.

afxgroup commented 1 month ago

That did the trick. Thank you

intraordinaire commented 1 month ago

Glad we could finally help you! Thank you for your patience 🙏