Skip to content
This repository has been archived by the owner on Mar 17, 2024. It is now read-only.

Invalid response: 400 #94

Open
mgiritli opened this issue Jul 3, 2020 · 5 comments
Open

Invalid response: 400 #94

mgiritli opened this issue Jul 3, 2020 · 5 comments

Comments

@mgiritli
Copy link

mgiritli commented Jul 3, 2020

I'm trying to use this library but could not get too far. The very simple line:

$client = new LEClient($email);

causes HTTP 400 error. Is it possible something have changed in the LE API recently that needs to be incorporated in LEClient?

Using php 7.4.6 & LEclient 1.2.2

@DarthShmev
Copy link

I'm getting an invalid response: 400 error as well when creating a new order.

@yourivw
Copy link
Owner

yourivw commented Jul 5, 2020

Have you filled your e-mail address and domain data in the example code? That has caused problems in the past. Then it might be a duplicate of #67.

@MrMooky
Copy link

MrMooky commented Aug 23, 2020

@yourivw Having the same problem.

LEClient\Exceptions\LEConnectorException
Invalid response: 400
ini_set('max_execution_time', 120);

$email = array($user->email);
$basename = $this->getTlDomain($request->custom_url);
$domains = array($request->custom_url);
$client = new LEClient($email, LEClient::LE_STAGING);

$email, $basename and $domains all output correct data. Although I'm not sure why the email is supposed to be an array. But anyway, that's how far I get. Now, I'm not sure if this is because of my localhost environment? Should still work, right?

[2020-08-23 07:27:29] local.ERROR: Invalid response: 400 {"userId":1,"exception":"[object] (LEClient\\Exceptions\\LEConnectorException(code: 21): Invalid response: 400 at /Users/-/Code/-/vendor/yourivw/leclient/src/Exceptions/LEConnectorException.php:69)
[stacktrace]
#0 /Users/-/Code/-/vendor/yourivw/leclient/src/LEConnector.php(167): LEClient\\Exceptions\\LEConnectorException::InvalidResponseException(Array)
#1 /Users/-/Code/-/vendor/yourivw/leclient/src/LEConnector.php(195): LEClient\\LEConnector->request('POST', 'https://acme-st...', '{\"protected\":\"e...')
#2 /Users/-/Code/-/vendor/yourivw/leclient/src/LEAccount.php(116): LEClient\\LEConnector->post('https://acme-st...', '{\"protected\":\"e...')
#3 /Users/-/Code/-/vendor/yourivw/leclient/src/LEAccount.php(82): LEClient\\LEAccount->getLEAccount()
#4 /Users/-/Code/-/vendor/yourivw/leclient/src/LEClient.php(156): LEClient\\LEAccount->__construct(Object(LEClient\\LEConnector), 0, Array, Array)
#5 /Users/-/Code/-/app/Http/Controllers/BaseController.php(284): LEClient\\LEClient->__construct(Array, 'https://acme-st...')
#6 [internal function]: App\\Http\\Controllers\\BaseController->updateDomain(Object(Illuminate\\Http\\Request))
#7 /Users/-/Code/-/vendor/laravel/framework/src/Illuminate/Routing/Controller.php(54): call_user_func_array(Array, Array)
#8 /Users/-/Code/-/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(45): Illuminate\\Routing\\Controller->callAction('updateDomain', Array)

@MrMooky
Copy link

MrMooky commented Sep 5, 2020

In my case, the error seems to be caused by the line $client = new LEClient($email, LEClient::LE_STAGING);.

@ggedde
Copy link

ggedde commented Nov 26, 2020

For me it was cause I was using the same Account key from Staging on Production. I had to delete the account key to recreate it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants