abm-werbeagentur / craft-translationhelper

Other
1 stars 0 forks source link

Ajax request fails when clicking on the «get translation button in the backend» #1

Closed manuelthaler closed 10 months ago

manuelthaler commented 1 year ago

Translation issue:

I've installted the plugin, set the default language but still get an error when trying to get the original text by clicking on the flag ch-DE in the backend.

Any suggestion for what goes wrong on my instance?  Message in the console:

  /admin/abm-translati…per/element/fetch:1 
  Failed to load resource: the server responded with a status of 400 ()

When clicking on the result site in the console of google chrome, I get the following Message:

    [HTTP 400 – Bad Request](https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#400) – [yii\web\BadRequestHttpException](https://www.yiiframework.com/doc-2.0/yii-web-badrequesthttpexception.html)
    Post request required

That's what it then logically looks like in the backend, when the request to load the original source fails.

image

About the site setup: There are multiple site instances in one.

I have the following setup: – ch-DE Zurich – ch-EN Zurich – ch-FR Zurich

– ch-DE Bern – ch-EN Bern – ch-FR Bern

etc. for a few more locations

In the configuration I've selected the ch-DE Zurich as no default, and ch-EN Zurich as well as ch-FR Zurich with the ch-DE Zurich as default value in your plugin configuration.

This is the comple message when having a look at the details in the xhr request:

  {
      "name": "Bad Request",
      "message": "Ihre Dateneingabe konnte nicht überprüft werden oder ist ungültig.",
      "code": 0,
      "error": "Ihre Dateneingabe konnte nicht überprüft werden oder ist ungültig.",
      "status": 400,
      "exception": "yii\\web\\BadRequestHttpException",
      "file": "/var/www/html/vendor/yiisoft/yii2/web/Controller.php",
      "line": 220,
      "trace": [
          {
              "file": "/var/www/html/vendor/craftcms/cms/src/web/Controller.php",
              "line": 171,
              "function": "beforeAction",
              "class": "yii\\web\\Controller",
              "type": "->"
          },
          {
              "file": "/var/www/html/vendor/yiisoft/yii2/base/Controller.php",
              "line": 176,
              "function": "beforeAction",
              "class": "craft\\web\\Controller",
              "type": "->"
          },
          {
              "file": "/var/www/html/vendor/yiisoft/yii2/base/Module.php",
              "line": 552,
              "function": "runAction",
              "class": "yii\\base\\Controller",
              "type": "->"
          },
          {
              "file": "/var/www/html/vendor/craftcms/cms/src/web/Application.php",
              "line": 304,
              "function": "runAction",
              "class": "yii\\base\\Module",
              "type": "->"
          },
          {
              "file": "/var/www/html/vendor/yiisoft/yii2/web/Application.php",
              "line": 103,
              "function": "runAction",
              "class": "craft\\web\\Application",
              "type": "->"
          },
          {
              "file": "/var/www/html/vendor/craftcms/cms/src/web/Application.php",
              "line": 289,
              "function": "handleRequest",
              "class": "yii\\web\\Application",
              "type": "->"
          },
          {
              "file": "/var/www/html/vendor/yiisoft/yii2/base/Application.php",
              "line": 384,
              "function": "handleRequest",
              "class": "craft\\web\\Application",
              "type": "->"
          },
          {
              "file": "/var/www/html/web/index.php",
              "line": 12,
              "function": "run",
              "class": "yii\\base\\Application",
              "type": "->"
          }
      ]
  }

This is a sample request when clicking on the «get the translation» button

{elementid: "2272", elementuid: "341ea110-d0fa-4407-8ab4-9bf8d488cfa9", originalsiteid: "7",…}

elementcontext    : 
"global"    elementid    :     "2272"
elementuid    :     "341ea110-d0fa-4407-8ab4-9bf8d488cfa9"
handle     :     "siteTeaserText"
originalsiteid    :     "7"

About the system and configuration:

php Version: 8.1.13 OS version : Linux 6.3.13-linuxkit Database driver & version: MariaDB 10.4.27 Craft edition & version: Craft Pro 4.5.6.1 Yii version: 2.0.48.1

Do you have any suggestion where to catch up to get the plugin running on my ddev instance? Or on the live environment?

elodiegrondin commented 11 months ago

Hello, I get the same issue. Did you find a workaround ? Thanks !

abm-schuh commented 10 months ago

Version 1.0.2 is out now with a fix for that. Thank you for reporting.