strongloop / loopback-example-offline-sync

Offline sync, change tracking, and replication.
http://loopback.io/doc/en/lb2/Synchronization.html
Other
285 stars 110 forks source link

Request expects at least host or hostname, but none given in browser mode #69

Closed Morriz closed 7 years ago

Morriz commented 9 years ago

The todo app's 'sync' button throws this error:

Uncaught Error: Invalid URI "/api/Todos/checkpoint"

And debugging I find that Request fails on this line:

if (!(self.uri.host || (self.uri.hostname && self.uri.port)) && !self.uri.isUnix) {

since we only call with a relative path.

Should it be necessary to make requests with an absolute uri? That would be silly for browsers, but if must for now, so be it...

bajtos commented 9 years ago

Should it be necessary to make requests with an absolute uri? That would be silly for browsers, but if must for now, so be it...

Hmm, that's rather unfortunate :( Perhaps we can use window.location.host when running in a browser? Ideally this change should be made directly in the request module.

@Morriz would you mind submitting the patch yourself?

Morriz commented 9 years ago

Sure, when I have the time. I already realized that the Request repo is where it should go :)

On 2 jun. 2015, at 16:16, Miroslav Bajtoš notifications@github.com wrote:

Should it be necessary to make requests with an absolute uri? That would be silly for browsers, but if must for now, so be it...

Hmm, that's rather unfortunate :( Perhaps we can use window.location.host when running in a browser? Ideally this change should be made directly in the request module.

@Morriz https://github.com/Morriz would you mind submitting the patch yourself?

— Reply to this email directly or view it on GitHub https://github.com/strongloop/loopback-example-offline-sync/issues/69#issuecomment-107970116.

stale[bot] commented 7 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] commented 7 years ago

This issue has been closed due to continued inactivity. Thank you for your understanding. If you believe this to be in error, please contact one of the code owners, listed in the CODEOWNERS file at the top-level of this repository.