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

problems in safari #13

Closed
javier-troconis-q2 opened this Issue Aug 31, 2015 · 17 comments

Comments

Projects
None yet
6 participants
@javier-troconis-q2

javier-troconis-q2 commented Aug 31, 2015

Hi there, we're having issues using the fetch-client library in safari. It fails as soon as we try to configure the client, please have a look @ http://embed.plnkr.co/wc2GDF for a basic sample. We also tried to configure the library using property setters instead of passing in a lambda expression, but then any subsequent "fetch" operation fails.

Thanks,
Javier.

@EisenbergEffect

This comment has been minimized.

Member

EisenbergEffect commented Aug 31, 2015

@bryanrsmith Could this be related to a missing polyfill? We should find a better way to handle that if it's the case. One solution is to make fetch depend on the polyfill, then implement it as an aurelia plugin..with the plugin's configure method detecting whether native fetch is present of not and loading the polyfill if appropriate. If we don't do that, we should definitely make sure to have very clear documentation on it.

@bryanrsmith

This comment has been minimized.

Member

bryanrsmith commented Sep 1, 2015

Yep. @javier-troconis-q2 the Fetch API isn't yet supported in Safari, so you'll need to include a polyfill like https://github.com/github/fetch. The aurelia fetch library doesn't include the polyfill at this time.

@EisenbergEffect What do you think is the best way to handle this? I originally left out the polyfill because 1) some environments (electron apps, for example) don't need it, and 2) polyfill implementations differ between node & the browser. If we add a dependency on a browser polyfill it won't work in node. There are universal polyfills, but they're larger... Do you think it's acceptable to just document the need for a polyfill? It should be pretty easy to detect lack of support for fetch & log a helpful message to the console.

@EisenbergEffect

This comment has been minimized.

Member

EisenbergEffect commented Sep 1, 2015

Let's start with the warning message. That will at least help people out in the mean time. I'm not quite sure what real solution should be yet. I know that we do want to support both client and server, especially since we want to have "universal" JS in the end. How much larger are the polyfills that cover both node and browser?

@nitrog7

This comment has been minimized.

nitrog7 commented Sep 2, 2015

+1

@KarlDirck

This comment has been minimized.

KarlDirck commented Sep 4, 2015

So to be clear, using the https://github.com/github/fetch with Aurelia-http-fetch is supported?
Additionally, the TypeScript definition for this project lacks references to some obejcts (Request, Response, BufferSource, URLSearchParams,) which if used with whatwg-fetch.d.ts (DefinitelyTyped) has collisions/conflicts. Some comments, documentation, guidance and/or suggestions would greatly help.
It seems Http-Client stopped working on many mobile device browsers which is what has prompted my research on this project instead.

@EisenbergEffect

This comment has been minimized.

Member

EisenbergEffect commented Sep 4, 2015

The http client stopped working?! What is wrong with that? @bryanrsmith

@nitrog7

This comment has been minimized.

nitrog7 commented Sep 4, 2015

iOS devices use mobile Safari. Since aurelia-http-fetch is not working with Safari, the mobile devices are broken as well. It works in Chrome but not Safari and Firefox. As a workaround, I’m using the fetch polyfill as a replacement.

On Sep 4, 2015, at 1:46 PM, Rob Eisenberg notifications@github.com wrote:

The http client stopped working?! What is wrong with that? @bryanrsmith https://github.com/bryanrsmith

Reply to this email directly or view it on GitHub #13 (comment).

@EisenbergEffect

This comment has been minimized.

Member

EisenbergEffect commented Sep 4, 2015

Ok I think I got confused. You are just referring to the fact that it's broken without the polyfill. Is that correct?

@nitrog7

This comment has been minimized.

nitrog7 commented Sep 4, 2015

Correct. At least in my case. I believe this is the situation for @KarlDirck as well.

@KarlDirck

This comment has been minimized.

KarlDirck commented Sep 4, 2015

The aurelia-http-client issue was observed on Android and iOS on Chrome and iOS mobile Safari. I am happy to help provide more information, if needed.

@KarlDirck

This comment has been minimized.

KarlDirck commented Sep 4, 2015

Additionally, I am trying to confirm if the aurelia-fetch-client would have maximum compatibility if used WITH the fetch polyfil from github referenced above. We have an immenent demo on iO (iPhone) that has to work by COB Tuesday.
Thanks.

@nitrog7

This comment has been minimized.

nitrog7 commented Sep 5, 2015

Yes. I can confirm the polyfill works on mobile and desktop browsers.

On Sep 4, 2015, at 6:22 PM, Karl Dirck notifications@github.com wrote:

Additionally, I am trying to confirm if the aurelia-fetch-client would have maximum compatibility if used WITH the fetch polyfil from github referenced above. We have an immenent demo on iO (iPhone) that has to work by COB Tuesday.
Thanks.


Reply to this email directly or view it on GitHub.

@javier-troconis-q2

This comment has been minimized.

javier-troconis-q2 commented Sep 5, 2015

@KarlDirck, just add "import 'fetch';" to the list of imports of your app.js. Also, make sure you have a fetch polyfill installed (https://github.com/github/fetch).

@KarlDirck

This comment has been minimized.

KarlDirck commented Oct 26, 2015

Thank you.

@jeff-h

This comment has been minimized.

jeff-h commented Mar 12, 2016

Sorry for such a newbie question, but could someone give me a helping hand on how to include the fetch polyfill (and only if it's needed), and where this code should go inside an Aurelia app?

@bryanrsmith

This comment has been minimized.

Member

bryanrsmith commented Mar 12, 2016

@jeff-h No problem! You can find instructions at https://github.com/aurelia/fetch-client/tree/master/doc#bring-your-own-polyfill. You can import the polyfill anywhere you like, as long as it's loaded before you try to use aurelia-fetch-client. That could be somewhere like main.js, or it could be in the specific view model or service module that uses aurelia-fetch-client.

@jeff-h

This comment has been minimized.

jeff-h commented Mar 12, 2016

Awesome! Thanks for that, and getting back so quickly! Those docs are exactly what I was hoping for. I didn't even go looking for docs in the fetch-client repo honestly — primarily because I am still being caught by surprise at the extent of the docs already in Aurelia :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment