accelasearch / prestashop-module

AccelaSearch module for Prestashop
Academic Free License v3.0
0 stars 0 forks source link

Invalid onboarding and sync #4

Open buggyzap opened 1 month ago

buggyzap commented 1 month ago

Prerequisites

Describe the bug and add attachments

The onboarding process fail at apikey verification step with an error message, after refresh the page it seems to work but the sync still not processing.

Expected behavior

Api key verification and sync succeed.

Steps to reproduce

  1. Install module
  2. Insert apikey
  3. Refresh the page
  4. Trigger the sync via cronjob

PrestaShop version(s) where the bug happened

8.1.4

PHP version(s) where the bug happened

8,0

Accelasearch module version

1.0.28

buggyzap commented 1 month ago

This error is caused by Guzzle library, in new versions it's not possible to include body payload as array to send a xxx formurl encoded post data but the data needs to be sent by a form_params option. Anyway the defaults headers and configuration is deprecated so have to specified manually in every call.

To fix the bug:

Change all DgcalClient POST to include form_params instead of body. Add the Apikey header in every call and not in the configuration globally of the Guzzle. Add an isset condition to the FeedGeneration Command when it try to set the controller_type to front. From latest versions of Prestashop the controller is null in this scenario so it create an exception.