Comments (11)
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 url
module, window.URL
works just great for our purposes. It seems that gaxios has no idea (yet) that it should use window.URL
, not the url
module. If my understanding is correct here I'll try to fix it now.
from gaxios.
Thanks @dmytrobanasko - I was able to repro that, #45 should fix the problem.
from gaxios.
That was fast =] Thank you!
from gaxios.
🎉 This issue has been resolved in version 1.7.0 🎉
The release is available on:
Your semantic-release bot 📦🚀
from gaxios.
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
at Gaxios.validateOpts (/var/task/node_modules/gaxios/build/src/gaxios.js:125:27)
at Gaxios. (/var/task/node_modules/gaxios/build/src/gaxios.js:60:25)
at next (native)
at /var/task/node_modules/gaxios/build/src/gaxios.js:19:71
at __awaiter (/var/task/node_modules/gaxios/build/src/gaxios.js:15:12)
at Gaxios.request (/var/task/node_modules/gaxios/build/src/gaxios.js:59:16)
at Object. (/var/task/node_modules/gaxios/build/src/index.js:38:33)
at next (native)
at /var/task/node_modules/gaxios/build/src/index.js:19:71
at __awaiter (/var/task/node_modules/gaxios/build/src/index.js:15:12)
from gaxios.
@vc102375 How exactly are you using the code? Is it a regular Node.js application - if so, which Node.js version is used?
from gaxios.
@vc102375 A wild guess: is there any chance that you have a global variable named window
defined somewhere? What does 'console.log(typeof window);` print in your code?
from gaxios.
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)
.then(results => {
console.log(results)
const translation = results[0];
return translation;
})
.catch(err => {
console.error('ERROR:', err);
return false
});
from gaxios.
This is tracking this issue: #54
from gaxios.
@vc102375 Oh, that's bad. URL
class was added in v6.13.0. The easiest way for you is switching to Node.js v8 since v6 will be EOL in less than a month.
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 npm install semver
to make it work. This code creates a global window
object with window.URL
that will make gaxios think it's running in browser mode, so it will use this instead of the URL class that will appear in v6.13.0. Thanks for semver
check, it will keep working even after you upgrade Node.js. Please try that and let me know if it helped.
from gaxios.
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.
from gaxios.
Related Issues (20)
- Upgrade node-fetch dependency to v3.2 HOT 3
- Your .repo-metadata.json file has a problem 🤒
- Your .repo-metadata.json file has a problem 🤒
- Ensuring compliance with SNI Extension requirement on remote host HOT 3
- Support proxy option instead of HTTP_PROXY env variable HOT 4
- Get request with one-item array param, will send the value inside instead the the array HOT 1
- Feature request: optional error throwing HOT 2
- 📦 pack and install: "before all" hook: pack and install for "should run the sample" failed HOT 4
- can i please for more docs about comparison with axios HOT 1
- Incorrect GaxiosError message type when request responseType "arrayBuffer" HOT 2
- Uncaught ReferenceError: process is not defined HOT 1
- content-type parsing is performed even if a `text` response type is explicitly requested, causing an unmanageable error HOT 3
- timeout - seconds or milliseconds HOT 1
- feat!: Use Native `cause` in `GaxiosError`
- Using googleapis for direct CSV downloads does not return CSV
- Typo on README.md
- feat: Updated `timeout` Implementation and Documentation HOT 1
- feat: Add `client_secret` to `defaultErrorRedactor` HOT 2
- Warning: a recent release failed HOT 1
- Warning: a recent release failed HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gaxios.