Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lack of NO_PROXY support with move to needle #351

Closed
4 of 5 tasks
sgoff0 opened this issue Dec 1, 2021 · 3 comments · Fixed by #442
Closed
4 of 5 tasks

Lack of NO_PROXY support with move to needle #351

sgoff0 opened this issue Dec 1, 2021 · 3 comments · Fixed by #442
Labels
bug Indicates an unexpected problem or unintended behavior

Comments

@sgoff0
Copy link

sgoff0 commented Dec 1, 2021

Software versions

Please provide at least OS and version of pact-js

  • OS: Mac OSX 11.6.1
  • Pact Node version: v10.14.0
  • Node Version: v12.22.1

Issue Checklist

Please confirm the following:

  • I have upgraded to the latest - I've tested latest as well but logs are from slightly older version, core issue is needle though but wanted to call it out here as it impacts Pact usability with a corporate proxy
  • I have the read the FAQs in the Readme
  • I have triple checked, that there are no unhandled promises in my code
  • I have set my log level to debug and attached a log file showing the complete request/response cycle - actually on trace
  • For bonus points and virtual high fives, I have created a reproduceable git repository (see below) to illustrate the problem

Root Cause

I want to be clear this is a problem introduced with a pact update when moving from request to needle but the root cause is a Needle issue not respecting NO_PROXY. This causes Pact to fail as we run it behind a corporate proxy. This worked as expected prior to the move to needle.

Expected behaviour

As a user behind a corporate proxy Pact should be able to make a successful network request to the mock service it spins up while respecting HTTP_PROXY and NO_PROXY environment variables (note it was working as expected with these older versions of pact & pact-node)

[2021-11-30 21:49:24.080 +0000] INFO (10049 on MLRW20127616): pact-node@10.12.2: Pact running on port 62080
[2021-11-30 21:49:24.532 +0000] INFO (10049 on MLRW20127616): pact@9.15.5: Setting up Pact with Consumer "xxxxx" and Provider "yyyyy"
    using mock service on Port: "62080"

Actual behaviour

Since move from request to needle connection to mock server fails on machines behind a corporate proxy despite setting NO_PROXY for localhost/127.0.0.1 (something the request library previously respected). In my use case needle's http request is intercepted and redirected by our corporate proxy causing it never to connect to the pact mock server thus causing pact contract tests to fail/not run.

[2021-12-01 15:17:15.403 +0000] INFO (33800 on MLRW20127616): pact-node@10.14.0: Pact running on port 54284
[2021-12-01 15:17:15.489 +0000] TRACE (33800 on MLRW20127616): pact@9.16.5: outgoing request
[2021-12-01 15:17:15.575 +0000] TRACE (33800 on MLRW20127616): pact@9.16.5:
    body: "<HTML><HEAD>\n<TITLE>Redirect</TITLE>\n</HEAD>\n<BODY>\n<FONT face=\"Helvetica\">\n<big><strong></strong></big><BR>\n</FONT>\n<blockquote>\n<TABLE border=0 cellPadding=1 width=\"80%\">\n<TR><TD>\n<FONT face=\"Helvetica\">\n<big>Redirect (authentication_redirect_to_virtual_host)</big>\n<BR>\n<BR>\n</FONT>\n</TD></TR>\n<TR><TD>\n<FONT face=\"Helvetica\">\nYou are being redirected to the authentication virtual host.\n</FONT>\n</TD></TR>\n<TR><TD>\n<FONT face=\"Helvetica\">\n\n</FONT>\n</TD></TR>\n<TR><TD>\n<FONT face=\"Helvetica\" SIZE=2>\n<BR>\nFor assistance, contact your network support team.<br><br>Your request was categorized by Blue Coat Web Filter as 'none'. <br>If you wish to question or dispute this result, please click <a href=\"http://sitereview.bluecoat.com/sitereview.jsp?referrer=136&url=http://127.0.0.1:54284/\">here</a>.\n</FONT>\n</TD></TR>\n</TABLE>\n</blockquote>\n</FONT>\n</BODY></HTML>\n"
    headers: {
      "location": "http://www.cfauth.com/?cfru=aHR0cDovLzEyNy4wLjAuMTo1NDI4NC8=",
      "cache-control": "no-cache",
      "pragma": "no-cache",
      "x-xss-protection": "1",
      "content-type": "text/html; charset=utf-8",
      "proxy-connection": "close",
      "connection": "close",
      "content-length": "867"
    }
    statusCode: 302
[2021-12-01 15:17:16.105 +0000] TRACE (33800 on MLRW20127616): pact@9.16.5: outgoing request
[2021-12-01 15:17:16.106 +0000] TRACE (33800 on MLRW20127616): pact@9.16.5:

Steps to reproduce

This happens when running any consumer test, specifically initiated during the call to @pact-foundation/pact's setup function when attempting to start the mock server.

@sgoff0 sgoff0 added the bug Indicates an unexpected problem or unintended behavior label Dec 1, 2021
@mefellows
Copy link
Member

This is great, thanks for the report and for the PR assistance in the Needle repository.

I thought we had a workaround for this, but it seems that is not the case.

We'll leave this open and upgrade needle when it is published.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 3, 2023

👋 Hi! The 'smartbear-supported' label has just been added to this issue, which will create an internal tracking ticket in PactFlow's Jira (PACT-790). We will use this to prioritise and assign a team member to this task. All activity will be public on this ticket. For now, sit tight and we'll update this ticket once we have more information on the next steps.

See our documentation for more information.

@mefellows
Copy link
Member

Looks like the latest version of needle added support for NO_PROXY. The build passed and has been released in 13.13.7.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or unintended behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants