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

Cannot clone a URL in Node >= 10 #109

Open
iambalaam opened this issue Dec 15, 2019 · 1 comment
Open

Cannot clone a URL in Node >= 10 #109

iambalaam opened this issue Dec 15, 2019 · 1 comment

Comments

@iambalaam
Copy link

The following code will run in node8, but break in node10 and node12.

const clone = require('clone');
const { URL } = require('url');
const url = new URL('https://example.com');

const url2 = clone(url);

It gives the following stacktrace

TypeError: Cannot set property 'flags' of undefined
    at URL.onParseComplete (internal/url.js:224:13)
    at URL.set [as href] (internal/url.js:443:7)
    at _clone (.../code/node-cache-fix/node_modules/clone/clone.js:162:16)
    at clone (.../code/node-cache-fix/node_modules/clone/clone.js:202:10)
    at Object.<anonymous> (.../code/node-cache-fix/clone-bug.js:5:14)
    at Module._compile (internal/modules/cjs/loader.js:701:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
    at Module.load (internal/modules/cjs/loader.js:600:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
    at Function.Module._load (internal/modules/cjs/loader.js:531:3)
@erdii
Copy link

erdii commented Dec 15, 2019

this causes node-cache/node-cache#127
just leaving this here so we get a ref to track this issue in the original issue thread

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

No branches or pull requests

2 participants