iisnode encountered an error when processing the request.

HRESULT: 0x6d
HTTP status: 500
HTTP subStatus: 1013
HTTP reason: Internal Server Error

You are receiving this HTTP 200 response because system.webServer/iisnode/@devErrorsEnabled configuration setting is 'true'.

In addition to the log of stdout and stderr of the node.exe process, consider using debugging and ETW traces to further diagnose the problem.

The last 64k of the output generated by the node.exe process to stderr is shown below:

(node:6588) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
sql query execution error:
SELECT TOP 1 * FROM [Webshop] 
                    WHERE [private_domain]=N'fantezibaz.ir'
{"code":"EREQUEST","originalError":{"sqlstate":"HYT00","code":0,"severity":0,"serverName":"","procName":"","lineNumber":0},"name":"RequestError","number":0,"lineNumber":0,"state":"HYT00","class":0,"serverName":"","procName":""}
RequestError: Query timeout expired
    at handleError (C:\inetpub\TX_Kalaban\node_modules\mssql\lib\msnodesqlv8\request.js:276:21)
    at StreamEvents.emit (node:events:514:28)
    at C:\inetpub\TX_Kalaban\node_modules\msnodesqlv8\lib\reader.js:83:20
    at Array.forEach (<anonymous>)
    at Query.routeStatementError (C:\inetpub\TX_Kalaban\node_modules\msnodesqlv8\lib\reader.js:73:19)
    at C:\inetpub\TX_Kalaban\node_modules\msnodesqlv8\lib\reader.js:239:12
    at C:\inetpub\TX_Kalaban\node_modules\msnodesqlv8\lib\driver.js:191:13
    at Immediate.<anonymous> (C:\inetpub\TX_Kalaban\node_modules\msnodesqlv8\lib\driver.js:167:9)
    at process.processImmediate (node:internal/timers:478:21) {
  code: 'EREQUEST',
  originalError: [Error: [Microsoft][SQL Server Native Client 11.0]Query timeout expired] {
    sqlstate: 'HYT00',
    code: 0,
    severity: 0,
    serverName: '',
    procName: '',
    lineNumber: 0
  },
  number: 0,
  lineNumber: 0,
  state: 'HYT00',
  class: 0,
  serverName: '',
  procName: ''
}
unhandledRejection: RequestError: Query timeout expired
sql query execution error:

WITH cteOwner AS (
    SELECT 'BC4577DA-CED4-41C3-9777-27BF6EB45893' AS [owner]
),
cteAvailableProducts AS (
	SELECT product_variation_id FROM dbo.F_ProductVariation_Stock_For_Webshop('BC4577DA-CED4-41C3-9777-27BF6EB45893') WHERE _stock > 0
),
cteMainQuery AS(
    SELECT
        uuid, title, public_id, brand, unit, is_virtual, tag_festival, tag_new, is_advanced_product, directory_id, is_available_on_webshop, created_at,
        cover_image,
        ISNULL(sell_price, 0) [sell_price], ISNULL(sell_price2, 0) [sell_price2], ISNULL(sell_price3, 0) [sell_price3], ISNULL(discount, 0) [discount],
        product_variation_count,
        IIF(is_available_on_webshop=0, 0, total_stock) AS total_stock,
        max_discount,
        sku_combined,
        _is_last,
        _r
    FROM (
        SELECT prd.*,
            (SELECT TOP 1 url FROM Media WHERE owner='BC4577DA-CED4-41C3-9777-27BF6EB45893' AND is_deleted=0 AND type='product_pic' AND Media.product_id=prd.uuid ORDER BY is_cover DESC, list_order, created_at) AS cover_image,
            cheapest_variation.*,
            variation_info.product_variation_count,
            variation_info.total_stock,
            variation_info.max_discount,
            variation_info.sku_combined,
            (CASE WHEN COUNT(*) OVER (PARTITION BY NULL) = ROW_NUMBER() OVER (ORDER BY (CASE WHEN total_stock > 0 THEN 1 ELSE 0 END) DESC, created_at DESC) THEN 1 ELSE 0 END) AS _is_last,
            ROW_NUMBER() OVER (ORDER BY (CASE WHEN total_stock > 0 THEN 1 ELSE 0 END) DESC, created_at DESC) AS _r
        FROM [Product] AS prd

        INNER JOIN (
            SELECT product_id, sell_price, sell_price2, sell_price3, discount FROM (
                SELECT *, ROW_NUMBER() OVER (PARTITION BY ProductVariation.product_id ORDER BY (CASE WHEN sell_price > 0 THEN 0 ELSE 1 END), sell_price) row_num 
                FROM ProductVariation 
                WHERE owner=(SELECT owner FROM cteOwner) AND is_deleted=0 
            ) AS _
            WHERE row_num = 1
        ) AS cheapest_variation
        ON prd.uuid = cheapest_variation.product_id

        INNER JOIN (
            SELECT pv.product_id,
                SUM(pvStock._stock) total_stock,
                IIF(MIN(pv.discount) < 0, MIN(pv.discount), MAX(pv.discount)) max_discount,
				COUNT(pv.uuid) product_variation_count,
                STRING_AGG(CONCAT(pv.sku_prefix, pv.sku_suffix), ' ') sku_combined
            FROM ProductVariation pv
            INNER JOIN V_ProductVariation_Stock_For_Webshop pvStock ON pv.uuid = pvStock.product_variation_id
            WHERE pv.owner='BC4577DA-CED4-41C3-9777-27BF6EB45893' AND pv.is_deleted=0
                AND 1=1
            GROUP BY pv.product_id
        ) AS variation_info
        ON prd.uuid = variation_info.product_id

        

        WHERE prd.owner='BC4577DA-CED4-41C3-9777-27BF6EB45893'
            AND prd.is_deleted=0 AND prd.active_for_webshop=1 AND prd.is_archived=0
            
            AND 1=1 AND 1=1 AND 1=1 AND directory_id IN ('4AC80147-676A-4166-A31E-9C012374FBE4')
    ) AS view1
),
cteGrouped AS (
    SELECT *, 'browse' AS _category FROM cteMainQuery
    WHERE _r > 0 AND _r <= 36
        -- AND ${where_browse}
    
)

SELECT * FROM cteGrouped
WHERE 1=1
ORDER BY _category, (CASE WHEN total_stock > 0 THEN 1 ELSE 0 END) DESC, created_at DESC
{"code":"EREQUEST","originalError":{"sqlstate":"HYT00","code":0,"severity":0,"serverName":"","procName":"","lineNumber":0},"name":"RequestError","number":0,"lineNumber":0,"state":"HYT00","class":0,"serverName":"","procName":""}
unhandledRejection: RequestError: Query timeout expired