-
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
URL is not a constructor at Gaxios.validateOpts #44
Comments
I checked the basic usage of webpacked libraries before we released v37.0.0 and it worked, but let me double check - until we're covered by some real tests, it's very possible we could break something without even noticing. Tests for browser stuff is WIP. We are not planning to use any polyfills for |
Thanks @dmytrobanasko - I was able to repro that, #45 should fix the problem. |
That was fast =] Thank you! |
🎉 This issue has been resolved in version 1.7.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
I am still facing this issue on lambda when i run google translate api's... 2019-03-05T18:32:45.289Z 5b2767e6-8af1-47b1-9b50-86ef389b2b78 TypeError: URL is not a constructor |
@vc102375 How exactly are you using the code? Is it a regular Node.js application - if so, which Node.js version is used? |
@vc102375 A wild guess: is there any chance that you have a global variable named |
using Node 6.10 , i am calling google translate api's thats all I am doing not calling gaxios directly . all was fine until 14 hours ago when redeployed the api on lambda to fix a issue. yield translate.translate(text, options) |
This is tracking this issue: #54 |
@vc102375 Oh, that's bad. As a quick workaround, you can add this to the very beginning of the your application: const url = require('url'); // legacy Node6 url
const semver = require('semver');
class Node6CompatibilityURL {
constructor(str) {
this.url = url.parse(str);
this.origin = this.url.protocol + '//';
this.pathname = this.url.pathname ? this.url.pathname : '';
this.search = this.url.search ? this.url.search : '';
this.href = this.url.href ? this.url.href : '';
}
}
if (semver.lt(process.version, '6.13.0')) {
window = {};
window.URL = Node6CompatibilityURL; // no warranty 😱
} Make sure you |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
It looks like after migration from axios to gaxios in googleapis v37.0.0 feat: make it webpackable feature does not work properly.
Build with webpack works fine but getting an error on any request:
URL is not a constructor at Gaxios.validateOpts
gaxios.ts#L151Node URL Api is incompatible with node-url in webpack's lib. Some details can be found here:
webpack/node-libs-browser#69
webpack/node-libs-browser#78
Is it supposed to be used with webpack ?
@alexander-fenster
The text was updated successfully, but these errors were encountered: