ionic-team / stencil Public
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
Prerender flag doesn't work with Axios #2969
Comments
|
Hey there, thank you for the patience getting back to you. The new team is getting started and we're working through the backlog now. Can you help us make a reproduction case? This would help us to identify and solve the problem sooner rather than later. Thank you! |
|
There is a repro case in the original issue: https://github.com/xvs32x/port-stencil I'm having the same problem with Stencil 2.8.0 and axios 0.21.3 |
|
I did some debugging and the problem seems to be that var urlParsingNode = document.createElement('a');
// urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
urlParsingNode.pathname === undefinedDefinition of class MockAnchorElement extends MockHTMLElement {
constructor(ownerDocument) {
super(ownerDocument, 'a');
}
get href() {
return fullUrl(this, 'href');
}
set href(value) {
this.setAttribute('href', value);
}
}@splitinfinities Is there any way we can extend |
|
@tricki Awesome investigation! Since that's in the definition we can add it yes, just link how href is being modified. I can't say when we can prioritize this, but if you do happen to add a PR we can get closer to getting it in. |
|
I created a pull request for adding Unfortunately Axios will still not work during prerender because In my case I replaced the Axios call with a |
|
It should work with Axios because of this code in the default.js. But in the function getDefaultAdapter() {
var adapter;
if (typeof XMLHttpRequest !== 'undefined') {
// For browsers use XHR adapter
adapter = xhr;
} else if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') {
// For node use HTTP adapter
adapter = xhr;
}
return adapter;
}So in my node server i get the error |
|
Good catch. It might be related to axios/axios#2731 |
|
How could the rollup configuration be updated then ? Could the stencil team give a hand on this? |
|
I just did a quick test and found a way to work around this. It's not a real solution but might help someone else debug the issue. What I did: So I installed and added |


As stated here - but wrongly closed - prerendering fails when using Axios
Problem is that some libraries like AWS AmplifyJS use Axios under the hood.
@adamdbradley Any idea how to solve this serious issue?
The text was updated successfully, but these errors were encountered: