Skip to content

refactor: replace node-fetch-commonjs with native fetch API #336

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

Merged
merged 3 commits into from
Feb 1, 2024

Conversation

sockmaster27
Copy link
Contributor

@sockmaster27 sockmaster27 commented Jan 31, 2024

Fixes #332

@sockmaster27
Copy link
Contributor Author

I have become aware that this is supported from Node 18

let readBytes = 0
res.body.on('data', (chunk: Buffer) => {
bodyStream.on('data', (chunk: Buffer) => {
Copy link
Member

Choose a reason for hiding this comment

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

How can we test this code? I guess a clean install would work. Did you try it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes

Copy link
Member

Choose a reason for hiding this comment

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

Do you happen to remember the local path I have to clean out to trigger a redownload? Or perhaps I can just run the command again?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

On Windows it's C:\Users\<username>\AppData\Roaming\Code\User\globalStorage\flix.flix\flix.jar

@magnus-madsen
Copy link
Member

image

File is downloaded, but something else breaks

@magnus-madsen
Copy link
Member

It is possible this PR was broken because of #328

It is also possible its their combination that is broken.

@sockmaster27
Copy link
Contributor Author

image

File is downloaded, but something else breaks

Strange. Neither of these PRs should touch anything that has to do with this.

Are you absolutely sure it's because of these changes?

@magnus-madsen
Copy link
Member

Reverting boths PRs fixed the problem. I suspect the problem was not in the node fetch, but in the response types PR. Probably an issue with undefined/null etc.

But I do not know.

@magnus-madsen
Copy link
Member

But it was 100% reproducible and revering both fixed it.

@sockmaster27
Copy link
Contributor Author

I cannot reproduce it on this branch, even though it includes both of these PRs.
Does this happen every time you start the extension, or only when the compiler has to be downloaded?
And again, I have to ask, are you absolutely positive that this is the cause? That particular error message is only caused by a failure to run CheckJavaVersion.class and parse its output, and none of these PRs goes anywhere near that logic.

@magnus-madsen
Copy link
Member

Yes, it was very reproducible. But it seems the download completed fine and then the failure happened.

Maybe its a nodejs or version issue? I switched to the newest node yesterday.

How about you reopen the node-fetch PR and then I try that alone without the type stuff?

@sockmaster27
Copy link
Contributor Author

Yes, it was very reproducible. But it seems the download completed fine and then the failure happened.

Maybe its a nodejs or version issue? I switched to the newest node yesterday.

How about you reopen the node-fetch PR and then I try that alone without the type stuff?

Does the whole extension not use the version of Node built into Electron?

@magnus-madsen
Copy link
Member

I have no idea. I guess your point is that nodejs is only used for the build. I guess that it possible.

@sockmaster27
Copy link
Contributor Author

I have no idea. I guess your point is that nodejs is only used for the build. I guess that it possible.

You're on macOS, right? Could that make a difference?

@magnus-madsen
Copy link
Member

I have both Win and Mac. This was Windows actually.

@sockmaster27 sockmaster27 deleted the fetch2 branch February 2, 2024 09:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Build errors
2 participants