cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Service Layer SQLQuery Proxy error

PVBruggie
Discoverer
0 Kudos
7,120

Hi Team, 

I am trying to alter a SQLQuery as follows:

Patch Endpoint: https://<ip server>:50000/b1s/v1/SQLQueries('AquisitionCosts')

Body:

{
 "SqlCode": "AquisitionCosts",
 "SqlName": "AquisitionCosts",
 "SqlText": "select ItemCode, sum(APC) as APC from (select distinct ItemCode, TransType, APC from FIX1 where TransType in (110, 115, 120)) as v1 where ItemCode like '_________________' group by ItemCode"
}
 
The SQL is working fine but I do receive a proxy error howver:
<html>

<head>
    <title>502 Proxy Error</title>
</head>
<body>
    <h1>Proxy Error</h1>
    <p>The proxy server received an invalid
        response from an upstream server.<br />
The proxy server could not handle the request
    <p>Reason: <strong>Error reading from remote server</strong></p>
    </p>
</body>
</html>

Accepted Solutions (0)

Answers (2)

Answers (2)

umasaral
Contributor
0 Kudos

Hi

Since the simplified query works and the original query runs fine in the database, the 502 Proxy Error might be due to proxy or server limits. Consider increasing the timeout settings or checking if there are any restrictions on large or complex queries in your proxy or server configuration

umasaral
Contributor
0 Kudos

Hi 

To resolve the 502 Proxy Error:

Validate SQL Query: Ensure the SQL query works directly in the database.
Check Endpoint and Authentication: Confirm the URL and authentication details are correct.
Review Server and Proxy Settings: Check server and proxy configurations for issues.
Simplify Query: Test with a simpler query to see if the issue is related to query complexity.

sample example:

Testing with Simplified Query:
SELECT ItemCode, COUNT(*) FROM FIX1 WHERE TransType IN (110, 115, 120) GROUP BY ItemCode

Example of Modified Request Body: Here's how you can format a simplified request body for testing:
{
"SqlCode": "AquisitionCosts",
"SqlName": "AquisitionCosts",
"SqlText": "SELECT ItemCode, SUM(APC) AS APC FROM (SELECT DISTINCT ItemCode, TransType, APC FROM FIX1 WHERE TransType IN (110, 115, 120)) AS v1 GROUP BY ItemCode"
}
By following these steps, you should be able to identify the root cause of the 502 Proxy Error and take appropriate actions to resolve it.

 

PVBruggie
Discoverer
0 Kudos
Hi Umasaral. Thanks for your reply! I did all of your suggestions:
PVBruggie
Discoverer
0 Kudos
Hi Umasaral. Thanks for your reply! I did all of your suggestions: The query runs ok directly in the database and when I try to update with a simple query, I do notreceive the proxy error and the query saves correctly
PVBruggie
Discoverer
0 Kudos
It seems that the servicelayer is not accepting a query with a subquery. For example the query "select ItemCode from (select * from FIX1) v1" gives me an error as well while the query is correct