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

There seems to be a syntax error in the 'lib/web/fetch/util.js' file, causing a compilation error. #2923

Closed
woohyun1031 opened this issue Mar 5, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@woohyun1031
Copy link

Bug Description

I upgraded to undici version 6.7.0 in a specific library I'm using, and I encountered a compilation error.
While tracing the issue, I found that it originated from the file 'lib/web/fetch/util.js'.
And the file is being compiled through the SWC loader in Next.js.
Of course, it could be a different error, but I'm curious if the exception handling within the FastIterableIterator class in the createIterator function in that file is correct.

class FastIterableIterator {
    /** @type {any} */
    #target;
...
    next() {
...
        if (typeof this !== 'object' || this === null || !(#target in this)) {
          throw new TypeError(
            `'next' called on an object that does not implement the iterator interface.`
          );
        }
...
    }
...

I'm curious whether the part where the exception handling is performed on line 776 should be changed from !(#target in this) to !(this.#target in this).

Logs & Screenshots

스크린샷 2024-03-05 오후 1 04 41

Environment

Mac M1 Pro
Next.js 14.0.1
Node v20.10.0

@woohyun1031 woohyun1031 added the bug Something isn't working label Mar 5, 2024
@tsctx
Copy link
Member

tsctx commented Mar 5, 2024

I think it is a swc issue.

@KhafraDev
Copy link
Member

#prop in this is valid syntax. This is not an issue in undici.

@fersan96
Copy link

fersan96 commented Apr 3, 2024

@woohyun1031 Hello, I hope you are doing well, I would like to know if you solved this problem?

@woohyun1031
Copy link
Author

@fersan96 Hello, Unfortunately, I couldn't resolve the issue. I had to downgrade the version of undici.
but it seems like Next.js parser issue. Check this #2954. It might be helpful to you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants