pantsel / kong-middleman-plugin

A Kong plugin that enables you to make an extra HTTP POST request before calling an API.
MIT License
156 stars 63 forks source link

bad argument #1 to 'receive'(bad pattern argument) #24

Open linlihuiyang opened 4 years ago

linlihuiyang commented 4 years ago

access.lua:94 bad argument #1 to 'receive'(bad pattern argument)

tushard-iprogrammer commented 4 years ago

@linlihuiyang have u been able to resolve it? We are facing the same issue.

tushard-iprogrammer commented 4 years ago

@linlihuiyang Through further debugging, this line tries to read the 'Content-Length' header from the response. And due to some reason, this header was removed. For us, the reason was a server-side monitoring tool 'Dynatrace'. It is adding cookie header to the original response and thus content-length is removed probably.

tushard-iprogrammer commented 4 years ago

@pantsel are there any other ways to read the response body without using Content-Length header in TCP socket connection? For now, as we can not remove the Dynatrace from client's setup, we have modified the access.lua to make an HTTP connection with the service. Please, if possible, guide us on if there are any risks in using HTTP instead of TCP. FYI - we have tried receive("*a") - it keeps the connection alive till the timeout and fails at browser due to timeout itself. we have tried receive("*l") - with a different regex as well, but it breaks after it has done reading the headers, not sure why.

abdulrazakbg commented 2 years ago

@tushard-iprogrammer @linlihuiyang . Its very old thread. have you got any solution for this ?

tushard-iprogrammer commented 2 years ago

Yeah. I had to rewrite some of the files. Basically, I rewrote them to use HTTP connection instead of TCP one.

And the main reason was:

Regards,

Tushar Dahiwale Senior Software Engineer @.***

iProgrammer Solutions Pvt. Ltd. Office 103, 104, 1st Floor Pride Portal, Shivaji Housing Society, Bahiratwadi, Near Hotel JW Marriott, Off Senapati Bapat Road, Pune - 411016, MH, INDIA. Phone: +91 9595456505 | Skype: tushard_iprogrammer www.iprogrammer.com http://www.iprogrammer.com/

On Fri, 22 Oct 2021 at 00:15, abdulrazakbg @.***> wrote:

@tushard-iprogrammer https://github.com/tushard-iprogrammer @linlihuiyang https://github.com/linlihuiyang . Its very old thread. have you got any solution for this ?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/pantsel/kong-middleman-plugin/issues/24#issuecomment-948903845, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADDVRRWJEU66KMYZU76YOADUIBNTBANCNFSM4LFVG7ZQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.