-
Notifications
You must be signed in to change notification settings - Fork 60
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
feat: v8 #599
Conversation
This removes all options, which would be undesirable. |
@wolfy1339 Thanks for the introspection here. @gr2m and I had a conversation about this change where three different scenarios presented themselves as to how to approach this (I'll paraphrase, and hopefully, @gr2m will jump in so that we can have a complete conversation about it). Here are the 3 options:
What do you think about the above? If you get a chance, please share why you think option three would be less desirable. I could definitely be missing something obvious as well, so your thoughts and perspective here would be appreciated! |
I believe that transparently passing options to the fetch function, would be ideal. That way we don't do any specific handling on our side, and users don't have to use a custom fetch function when they need to pass options. We can then remove documentation on the options, and direct users to the documentation for their implementation of that fetch function, whether it be That would offer some lesser level of breaking change for users |
Hey @wolfy1339, thanks for the thoughts/feedback - we're you thinking the implementation would look something like this? |
Changes need to be made to
Currently, this won't work as-is. Here is a couple points I'm seeing that will cause conflict with this PR:
|
test/request.test.ts
Outdated
@@ -561,7 +561,8 @@ x//0u+zd/R/QRUzLOw4N72/Hu+UG6MNt5iDZFCtapRaKt6OvSBwy8w== | |||
); | |||
}); | |||
|
|||
it("options.request.signal is passed as option to fetch", function () { | |||
//TODO: figure out the expected behavior | |||
it.skip("options.request.signal is passed as option to fetch", function () { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Linking docs for the signal
option for clearer context: https://developer.mozilla.org/en-US/docs/Web/API/fetch#signal
This test seems like a sanity check to make sure the option is passed along by passing a value that isn't the expected type and checking if it throws an error
Example:
> fetch("https://example.com",{signal:"bar"})
Promise {
<pending>,
[Symbol(async_id_symbol)]: 294,
[Symbol(trigger_async_id_symbol)]: 5
}
> Uncaught:
TypeError: Failed to construct 'Request': member signal is not of type AbortSignal.
at Object.fetch (node:internal/deps/undici/undici:11457:11)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In that case, with these breaking changes, should this test be removed? If we're expecting the caller to bring their own fetch, perhaps we shouldn't test on the internals of those options.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that this is the only test that checks if the options were properly passed along.
I think it should be fine to remove it
Even with the most recent changes, this won't work. Continuing on with the thoughts on my previous comment, For option 3, (or is it option 1) only allow setting To pass through options, we would still require the |
how about we add I was initially preferring to just support |
👍 This is a good idea |
This seems like a reasonable approach. Concretely you are suggesting the following (please correct me if I am wrong on anything so that I know we are all on the same page):
Some of the options above seem superfluous/unnecessary for the type of support we're trying to give, the way API requests are made to our API - things like:
Let me know if all of this sounds right or what needs to be adjusted. |
I think @nickfloyd's take is reasonable; we shouldn't support other ways of passing in authentication. I'm ready/willing to carry out this work if we can get consensus on the approach. |
I think removing the 1st three will result in a major pain, I would keep these as first class citizen options. Or at least be very cautious about removing them, do a proper deprecation to give people time to move away from it. But even if painful, I think it's the right call at this point. Make octokit less magic, rely more on web standards
I would start out with only supporting options explicitly that we know are useful. Adding more fetch options in future is simple, but removing them if we run into any complications will be a pain. I'm not actually sure what they all do and how they are supported. I'd definitely start out with method, headers, body, and signal. I'm not sure about the rest, and would probably vote no but instead open an issue to discuss them before adding them |
I agree. Authentication is a first-class citizen concern for us. I was wondering in the past if we should support the same authentication options as we support for the Octokit constructor in |
Here's a follow-up based on Nick's plan above:
Thoughts? |
I agree with the plan. It seems well thought out |
Step one in the plan presented here exists on this PR in its current state. Should the other steps be part of this PR as well or split up (perhaps using other PRs into this branch)? |
I think that for now, we can leave this PR as-is in order to unblock downstream updates ASAP. Further follow-ups can be made for the remaining points |
Sounds good! I've marked the PR as ready for review. Since @nickfloyd and I were the committers, I'll wait for approval/merge from you or @gr2m before proceeding with rolling out updates across other repos. |
octokit/types.ts#561 needs to be merged as a prerequisite to this PR The version will need to be updated in this PR as well |
👍 I've marked that PR as ready for review and I'll update the version here once it's released. |
That PR has been merged |
Thanks! Package has been updated here. After this, according to the plan, I believe the idea is to update core.js first, then octokit.js, app.js, and rest.js. Is that correct? |
We need to update the dependencies of Then the dependencies of Octokit.JS is the final one to get updated, as it depends on all the other modules |
🎉 This PR is included in version 8.0.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
* Fixed regression of redirect option being passed through to fetch introduced in #599, and moves it instead to the `requestOption.request` object * build: upgrade jest to fix test regression with `globalThis` being read-only
* Fixed regression of redirect option being passed through to fetch introduced in #599, and moves it instead to the `requestOption.request` object * build: upgrade jest to fix test regression with `globalThis` being read-only
BREAKING CHANGE: Replace support for Node.js http(s) Agents with documentation on using fetch dispatchers instead
RE: octokit/octokit.js#2484
Node's native fetch method does not support using a Node http(s) agent, because it's not built on top of Node's http module (it's built on top of the net module instead).
Behavior
Before the change?
After the change?
Additional info
Pull request checklist
Does this introduce a breaking change?
Please see our docs on breaking changes to help!
Type: Breaking change
label)