aade-mydata icon indicating copy to clipboard operation
aade-mydata copied to clipboard

myDATA servers are down or unreachable. Please try again later

Open kkonstas88 opened this issue 7 months ago • 7 comments

Hello,

I'm getting the above error as a catch in MyDataException when try to use $responses = $sender->handle($invoices);

I wonder if it's a problem from MyData or it's my problem. How Could I test it?

Thanks you in advance.

kkonstas88 avatar May 15 '25 10:05 kkonstas88

Hi, it's exactly what the error says. Unfortunately, myDATA dev environment has been unreachable in the past several days.

firebed avatar May 15 '25 12:05 firebed

Although, I just tested it and seems to be working properly now.

firebed avatar May 15 '25 12:05 firebed

that is the problem I stacked. I can't figure out why I'm getting this exception.

kkonstas88 avatar May 15 '25 13:05 kkonstas88

Would you mind sharing some details on your setup?

firebed avatar May 15 '25 14:05 firebed

I also checked credentials with validateCredentials() and everything it's ok

kkonstas88 avatar May 15 '25 14:05 kkonstas88

Which is the simplest way to check connection with aade? Before using sendInvoices or other function

kkonstas88 avatar May 15 '25 14:05 kkonstas88

You can try to retrieve your invoices:

<?php

require_once __DIR__ . '/vendor/autoload.php';

use Firebed\AadeMyData\Exceptions\MyDataException;
use Firebed\AadeMyData\Http\MyDataRequest;
use Firebed\AadeMyData\Http\RequestTransmittedDocs;

$userId = 'user-id';
$subscriptionKey = 'subscription-key';
$env = 'dev';

MyDataRequest::init($userId, $subscriptionKey, $env);

try {
    $requestTransmittedDocs = new RequestTransmittedDocs();
    $transmittedInvoices = $requestTransmittedDocs->handle();

    // To get the XML response
    echo $requestTransmittedDocs->getResponseXML();
    
    foreach ($transmittedInvoices as $invoice) {
        // Process each invoice
    }
} catch (MyDataException $e) {
    echo $e->getMessage();
}

firebed avatar May 15 '25 14:05 firebed

I got exactly the same message!

kkonstas88 avatar May 16 '25 08:05 kkonstas88

the row that creates exception is:

try { $responses = $sender->handle($invoices);

What else should I Check?

kkonstas88 avatar May 16 '25 08:05 kkonstas88

If you set a timeout make sure it's not too low. If that's not the case can you please post the whole stack trace?

firebed avatar May 16 '25 10:05 firebed

What do you mean by "the whole stack trace?"

kkonstas88 avatar May 16 '25 12:05 kkonstas88

is this helpful;

#Software: Microsoft Internet Information Services 10.0 #Version: 1.0 #Date: 2025-05-16 11:18:18 #Fields: date time s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs(User-Agent) cs(Referer) sc-status sc-substatus sc-win32-status time-taken 2025-05-16 11:18:18 172.21.10.6 GET / - 443 - 185.79.190.5 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/136.0.0.0+Safari/537.36 https://erpmydatadev.toradirect.gr/ 200 0 0 610 #Software: Microsoft Internet Information Services 10.0 #Version: 1.0 #Date: 2025-05-16 13:36:40 #Fields: date time s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs(User-Agent) cs(Referer) sc-status sc-substatus sc-win32-status time-taken 2025-05-16 13:36:40 172.21.10.6 GET / - 443 - 185.79.190.5 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/136.0.0.0+Safari/537.36 https://erpmydatadev.toradirect.gr/ 200 0 0 662 2025-05-16 13:36:48 172.21.10.6 GET / - 443 - 185.79.190.5 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/136.0.0.0+Safari/537.36 https://erpmydatadev.toradirect.gr/ 200 0 0 104 2025-05-16 13:47:53 172.21.10.6 GET / - 443 - 185.79.190.5 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/136.0.0.0+Safari/537.36 https://erpmydatadev.toradirect.gr/ 200 0 0 192 2025-05-16 13:47:58 172.21.10.6 GET / - 443 - 185.79.190.5 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/136.0.0.0+Safari/537.36 https://erpmydatadev.toradirect.gr/ 200 0 0 186

kkonstas88 avatar May 16 '25 13:05 kkonstas88

If you run the following code (after replacing the user-id and subscription-key) you will get an exception. Can you please post all the exception output here? Just make sure you are not exposing any sensitive data. It will also print the endpoint url, can you post it too?

<?php

require_once __DIR__ . '/vendor/autoload.php';

use Firebed\AadeMyData\Http\MyDataRequest;
use Firebed\AadeMyData\Http\RequestTransmittedDocs;

$userId = 'user-id';
$subscriptionKey = 'subscription-key';
$env = 'dev';

MyDataRequest::init($userId, $subscriptionKey, $env);

$requestTransmittedDocs = new RequestTransmittedDocs();

echo $requestTransmittedDocs->getUrl();

$requestTransmittedDocs->handle();

firebed avatar May 16 '25 14:05 firebed

Hello and thank you very much for your help!

url printed is: https://mydataapidev.aade.gr/RequestTransmittedDocs

also attached exception text.

Fatal error Uncaught GuzzleHttpExce.txt

kkonstas88 avatar May 19 '25 07:05 kkonstas88

You are probably using localhost without SSL/TLS. Please try disabling the client verification before the call:

MyDataRequest::verifyClient(false); 

Full snipppet:

<?php

require_once __DIR__ . '/vendor/autoload.php';

use Firebed\AadeMyData\Http\MyDataRequest;
use Firebed\AadeMyData\Http\RequestTransmittedDocs;

$userId = 'user-id';
$subscriptionKey = 'subscription-key';
$env = 'dev';

MyDataRequest::init($userId, $subscriptionKey, $env);
MyDataRequest::verifyClient(false); // <= Add this line

$requestTransmittedDocs = new RequestTransmittedDocs();

echo $requestTransmittedDocs->getUrl();

$requestTransmittedDocs->handle();

Only do this when you are on dev and localhost.

firebed avatar May 19 '25 07:05 firebed

I have already did it 1-2 days before. I did it again now but the same result.

kkonstas88 avatar May 19 '25 07:05 kkonstas88

Any other idea?

kkonstas88 avatar May 19 '25 08:05 kkonstas88

If I could help in order to help me!

with localhost and same code I get no exception and talking normally with MyData.

In this case, I have created a subdomain to an IIS server where cerificates are ok. I have checked it.

And either with "MyDataRequest::verifyClient(false);" or without I am getting "Connection refused". The question is why...

kkonstas88 avatar May 19 '25 10:05 kkonstas88

It seems like there's an SSL certificate problem with your site. When I visited toradirect.gr, Chrome displayed a certificate error - the certificate is actually issued for opap.gr, not your domain. This mismatch could be preventing secure connections.

Image

Also, you should check if there are any network restrictions on your server. Try connecting via SSH and run this command to make sure DNS resolution is working properly:

 nslookup mydataapidev.aade.gr

It's also worth checking if your server's firewall is blocking outbound connections. Let me know what you find after checking these issues!

Edit: You can also run this command via SSH

 curl -v https://mydataapidev.aade.gr/RequestTransmittedDocs?mark=

You should see something like

curl : { "statusCode": 401, "message": "Access denied due to missing subscription key. Make sure to include subscriptio
n key when making requests to an API." }

firebed avatar May 19 '25 13:05 firebed

thank you for your patience and your help.

We are talking about a windows server so I have already call on browser - https://mydataapidev.aade.gr/RequestTransmittedDocs and I get the following:

Image

I am going to check with ssh as you said and I will get back

kkonstas88 avatar May 20 '25 06:05 kkonstas88

Image

kkonstas88 avatar May 20 '25 11:05 kkonstas88

Image

kkonstas88 avatar May 20 '25 11:05 kkonstas88

Since your DNS resolution is working, basic curl access is successful, and the certificate is valid, the problem might to be specifically related to how Guzzle/PHP is trying to connect to the service.

Try this:

[!CAUTION] This will expose your user-id and subscription-key. Be EXTREMLY careful before posting anything here.

MyDataRequest::init($userId, $subscriptionKey, $env);
MyDataRequest::setRequestOptions([
    'verify' => true,  // Try both true and false
    'debug' => true, // Enables debugging and exposes credentials
    'curl' => [
        CURLOPT_SSL_VERIFYPEER => 1,
        CURLOPT_SSL_VERIFYHOST => 2,
    ]
]);

$requestTransmittedDocs = new RequestTransmittedDocs();

$requestTransmittedDocs->handle();

firebed avatar May 20 '25 13:05 firebed

I finally managed to proceed! Some php settings were needed based on your instructions for curl etc. Thank you once again

kkonstas88 avatar May 20 '25 13:05 kkonstas88

That's wonderful! Glad to help.

firebed avatar May 20 '25 13:05 firebed