Skip to content
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

Bug: Response with status: 200 for URL: null (tns-core-modules 2.5.2) #3924

Closed
Taremeh opened this issue Apr 1, 2017 · 5 comments
Closed

Bug: Response with status: 200 for URL: null (tns-core-modules 2.5.2) #3924

Taremeh opened this issue Apr 1, 2017 · 5 comments

Comments

@Taremeh
Copy link

@Taremeh Taremeh commented Apr 1, 2017

Hi,
I'm experiencing a bug with the new 2.5.2 tns-core-modules (Android), when I try to do an HTTP-request. It fails with an "error" (but 200 actually means success?):
Response with status: 200 for URL: null

However, I can't retrieve any data with the new modules. No other errors.
Other dependencies remained the same ("@angular/http": "2.1.2" etc.)

I had to downgrade the tns-core-modules to 2.4.3. With this version, everything works fine...

I'm using the same technique to GET-Request as shown here:
https://github.com/NativeScript/nativescript-sdk-examples-ng/blob/master/app/http/http-get/http-get.services.ts#L17

These are the dependencies (package.json) with the working version:
https://github.com/Taremeh/apphovenAlpha/blob/master/apphovenAlpha/package.json

Btw:
I also can not use the new Typescript version 2.2.2 (which got updated with Nativescript 2.5):

Found peer TypeScript 2.2.2
node_modules/tns-core-modules/declarations.d.ts(3,15): error TS2300: Duplicate identifier 'Request'.

and much more duplicates
... 

So I downgraded Typescript back to 2.1.6 and the app works again.
I also found this issue here (There seems to be coming a permanent fix with {N} 3.0?):
https://discourse.nativescript.org/t/app-wont-build-after-updating-to-2-5-1/646/4
(NativeScript/nativescript-dev-typescript#19 (comment))

Whatsoever, I'd really love to upgrade and update to the newer Nativescript versions. Therefore, I'll post everything needed, to reproduce this bug.

@NickIliev

This comment has been minimized.

Copy link
Member

@NickIliev NickIliev commented Apr 3, 2017

Regarding HTTP issue
@Taremeh we will need more info to investigate your issue. Indeed status 200 means that you have succeeded in connecting to the server. What is the full response received from your server? Is your server using SSLor are you trying to connect to localhost - similar problems were discussed here

Also the map in our example works fine for httpbin.org but you might need to goo deep for your server (again we need the full response from the server to know exactly how to parse the result)
e.g.

.map(result => result.json().data)

I have also created test application using 2.5.2 CLI and modules 2.5.2 and all the angular dependencies with versions from the default template and it works as expected/ Here you can find the test application to compare with your own.

If you стилл encounter this behavior please post a sample project that can reproduce the case (with server URL and all requirements needed)

Regarding TypeScript issue
There are some changes introduced in TypeScript 2.2.x and at the current state NativeScript 2.5.x and prior are working with TypeScript .2.1.x and below.
The support for TypeScript 2.2.x and above will be supported in our next release (3.0.0) where the support for TS 2.1.x and below will not be supported.

@Taremeh

This comment has been minimized.

Copy link
Author

@Taremeh Taremeh commented Apr 3, 2017

@NickIliev Thx for your fast answer.
I use SSL / HTTPS. Today I updated back to the new 2.5.2 tns-core-modules: And I really don't know why, but it worked!

However other things start breaking:
#3625

A little disappointed 😞
I'll have to stay with tns-core-modules 2.4.3, although there are other issues, which are fixed with the new 2.5.2 (#3218) or the tns-core-modules@next 2.6 (#3574).

However, 2.6 doesn't work because of TypeScript incompatibility:
Not with Typescript 2.2:

Found peer TypeScript 2.2.2
app/shared/firebase/login.service.ts(59,12): error TS2693: 'Promise' only refers to a type, but is being used as a value here.

node_modules/@angular/common/src/directives/ng_class.d.ts(46,34): error TS2304: Cannot find name 'Set'.

node_modules/@angular/compiler/src/compile_metadata.d.ts(347,20): error TS2304: Cannot find name 'Set'.

node_modules/@angular/compiler/src/compile_metadata.d.ts(348,15): error TS2304: Cannot find name 'Set'.
node_modules/@angular/compiler/src/offline_compiler.d.ts(19,32): error TS2304: Cannot find name 'Map'.

node_modules/@angular/compiler/src/output/output_ast.d.ts(424,63): error TS2304: Cannot find name 'Set'.

node_modules/@angular/core/src/change_detection/differs/default_keyvalue_differ.d.ts(24,15): error TS2304: Cannot find name 'Map'.
node_modules/@angular/core/src/change_detection/differs/default_keyvalue_differ.d.ts(28,16): error TS2304: Cannot find name 'Map'.

node_modules/@angular/core/src/di/reflective_provider.d.ts(88,123): error TS2304: Cannot find name 'Map'.

node_modules/@angular/core/src/di/reflective_provider.d.ts(88,165): error TS2304: Cannot find name 'Map'.

... AND MORE ...

and even with Typescript 2.1.6 build errors:

Found peer TypeScript 2.1.6
app/shared/firebase/login.service.ts(59,12): error TS2304: Cannot find name 'Promise'.

app/shared/firebase/piece.service.ts(14,90): error TS2304: Cannot find name 'Promise'.

node_modules/@angular/common/src/directives/ng_class.d.ts(46,34): error TS2304: Cannot find name 'Set'.

node_modules/@angular/common/src/pipes/async_pipe.d.ts(44,38): error TS2304: Cannot find name 'Promise'.

node_modules/@angular/compiler/src/compile_metadata.d.ts(347,20): error TS2304: Cannot find name 'Set'.

node_modules/@angular/compiler/src/compile_metadata.d.ts(348,15): error TS2304: Cannot find name 'Set'.
node_modules/@angular/compiler/src/directive_normalizer.d.ts(19,100): error TS2304: Cannot find name 'Promise'.

node_modules/@angular/compiler/src/directive_normalizer.d.ts(21,74): error TS2304: Cannot find name 'Promise'.

node_modules/@angular/compiler/src/offline_compiler.d.ts(19,32): error TS2304: Cannot find name 'Map'.

node_modules/@angular/compiler/src/offline_compiler.d.ts(43,9): error TS2304: Cannot find name 'Promise'.

node_modules/@angular/compiler/src/output/output_ast.d.ts(424,63): error TS2304: Cannot find name 'Set'.

... AND MORE ...

Bit of a mess right now 😢
Hope this will be fixed with Nativescript 3.0?

@Taremeh Taremeh closed this Apr 3, 2017
@NickIliev

This comment has been minimized.

Copy link
Member

@NickIliev NickIliev commented Apr 4, 2017

@Taremeh indeed nativeScript 3.0 will fix all of the posted issues plus it will introduce some great performance optimizations along with some breaking changes - stay in touch and expect the next official release pretty soon.
As for the TypeScript version: as TS introduced some breaking changes in TS v.2.2.X we've made all versions of NativeScript before 2.5.x compatible with TSv2.1.x.
TypeScript versions 2.2.x will be compatible with NativeScript 3.x.x.

@flynsequeira

This comment has been minimized.

Copy link

@flynsequeira flynsequeira commented Feb 8, 2019

I'm still getting this issue. Using...
import { Http, Headers, Response } from "@angular/http";
...

return this.http.post(
      Config.apiUrl + "api/users/register",
      {
        email: user.email,
        password: user.password
      },
      { headers: this.getCommonHeaders() }
    )
@lock

This comment has been minimized.

Copy link

@lock lock bot commented Feb 9, 2020

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.

@lock lock bot locked and limited conversation to collaborators Feb 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.