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

[Service Bus] [Event Hubs] Updated https-proxy-agent #4187

Closed
wants to merge 3 commits into from

Conversation

sadasant
Copy link
Contributor

@sadasant sadasant commented Jul 6, 2019

Version 2.2.2 was released with some TypeScript definitions! Time to
update.

Fixes #3064

Version 2.2.2 was released with some TypeScript definitions! Time to
update.

Fixes Azure#3064
@sadasant sadasant self-assigned this Jul 6, 2019
@sadasant sadasant requested a review from ramya-rao-a July 6, 2019 03:07
@sadasant sadasant added Event Hubs Service Bus Client This issue points to a problem in the data-plane of the library. labels Jul 6, 2019
@sadasant sadasant changed the title [ServiceBus] [EventHubs] Updated https-proxy-agent [Service Bus] [Event Hubs] Updated https-proxy-agent Jul 6, 2019
const url = require("url");
const httpsProxyAgent = require("https-proxy-agent");
import url from "url";
import httpsProxyAgent, { HttpsProxyAgentOptions } from "https-proxy-agent";
Copy link
Contributor

@ramya-rao-a ramya-rao-a Jul 8, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't this be

import { HttpsProxyAgent, HttpsProxyAgentOptions } from "https-proxy-agent"

?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It actually can't be neither import httpsProxyAgent from "https-proxy-agent"; or import { HttpsProxyAgent } from "https-proxy-agent";. Seems like I need to add the current export as the default property of the exported value. I'll elaborate:

Right now, https-proxy-agent is exporting it's default method by just doing:

https://github.com/TooTallNate/node-https-proxy-agent/blob/master/index.js#L16

I'm guessing it has to be changed to something like:

module.exports = HttpsProxyAgent;
module.exports.default = module.exports;

Would that work? Seems risky.

I'll change these imports to use require for now.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In that I case, I would skip the import and use of HttpsProxyAgentOptions altogether.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue is that this code used to fail using tsc 🤔 that's why I opened #3064

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its hard to believe that the lack of typing for the options object was what caused tsc to fail

It feels weird to import/require from the same module twice

Can't we do import httpsProxyAgent from "https-proxy-agent" and then not use the type when defining options?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll give it a try again! I'll come back with updates

@sadasant
Copy link
Contributor Author

I'll close this PR since we haven't been able to get back to it for a long time. This is probably not relevant anymore.

@sadasant sadasant closed this Nov 11, 2019
@sadasant sadasant deleted the feature/fix3064 branch November 11, 2019 19:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Client This issue points to a problem in the data-plane of the library. Event Hubs Service Bus
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[JS] [Service Bus] Fix missing TypeScript definitions for https-proxy-agent
3 participants