Skip to content

Angular SSR with SSL is broken with the http client get for relative url #26652

Closed

Description

@SetoKaiba

Command

serve

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

No response

Description

httpClient.get('assets/test.json')

It's working without SSL.
But it is broken after I use SSL.
The url becomes https://undefined/assets/test.json.

Minimal Reproduction

httpClient.get('assets/test.json')

Exception or Error

ERROR HttpErrorResponse {
  headers: _HttpHeaders {
    normalizedNames: Map(0) {},
    lazyUpdate: null,
    headers: Map(0) {}
  },
  status: 0,
  statusText: 'Unknown Error',
  url: 'https://undefined/assets/test.json',
  ok: false,
  name: 'HttpErrorResponse',
  message: 'Http failure response for https://undefined/assets/test.json: 0 undefined',
  error: TypeError: fetch failed
      at node:internal/deps/undici/undici:12442:11
      at _ZoneDelegate.invoke (e:/WebstormProjects/ciyuan-frontend/node_modules/zone.js/fesm2015/zone-node.js:368:26)
      at Object.onInvoke (e:/WebstormProjects/ciyuan-frontend/node_modules/@angular/core/fesm2022/core.mjs:14695:33)
      at _ZoneDelegate.invoke (e:/WebstormProjects/ciyuan-frontend/node_modules/zone.js/fesm2015/zone-node.js:367:52)
      at _Zone.run (e:/WebstormProjects/ciyuan-frontend/node_modules/zone.js/fesm2015/zone-node.js:129:43)
      at eval (e:/WebstormProjects/ciyuan-frontend/node_modules/zone.js/fesm2015/zone-node.js:1188:36)
      at _ZoneDelegate.invokeTask (e:/WebstormProjects/ciyuan-frontend/node_modules/zone.js/fesm2015/zone-node.js:402:31)
      at eval (e:/WebstormProjects/ciyuan-frontend/node_modules/@angular/core/fesm2022/core.mjs:14369:55)
      at AsyncStackTaggingZoneSpec.onInvokeTask (e:/WebstormProjects/ciyuan-frontend/node_modules/@angular/core/fesm2022/core.mjs:14369:36)
      at _ZoneDelegate.invokeTask (e:/WebstormProjects/ciyuan-frontend/node_modules/zone.js/fesm2015/zone-node.js:401:60) {
    cause: Error: getaddrinfo ENOTFOUND undefined
        at GetAddrInfoReqWrap.onlookupall [as oncomplete] (node:dns:118:26) {
      errno: -3008,
      code: 'ENOTFOUND',
      syscall: 'getaddrinfo',
      hostname: 'undefined'
    }
  }
}

Your Environment

Node.js version v21.4.0 detected.                                                                                                                                              
Odd numbered Node.js versions will not enter LTS status and should not be used for production. For more information, please see https://nodejs.org/en/about/previous-releases/.

     _                      _                 ____ _     ___ 
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | | 
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | | 
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/                                        
                                                             

Angular CLI: 17.0.6       
Node: 21.4.0 (Unsupported)
Package Manager: npm 10.2.4
OS: win32 x64

Angular: 17.0.6
... animations, cli, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, platform-server
... router, ssr

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1700.6
@angular-devkit/build-angular   17.0.6
@angular-devkit/core            17.0.6
@angular-devkit/schematics      17.0.6
@angular/cdk                    17.0.3
@angular/material               17.0.3
@schematics/angular             17.0.6
rxjs                            7.8.1
typescript                      5.2.2
zone.js                         0.14.2

Warning: The current version of Node (21.4.0) is not supported by Angular.

Anything else relevant?

No response

Activity

  1. alan-agius4 commented on Dec 12, 2023

    @alan-agius4
    Collaborator

    @SetoKaiba, I am not really understanding when this happen, does this happen during prerendering, ng serve or when running the production server?

  2. SetoKaiba commented on Dec 12, 2023

    @SetoKaiba
    Author

    @SetoKaiba, I am not really understanding when this happen, does this happen during prerendering, ng serve or when running the production server?

    I'm running with ng serve. It's happening during prerendering. It's in the SSR side, not the client side. @alan-agius4

  3. self-assigned this
    on Dec 13, 2023
  4. added 6 commits that reference this issue on Dec 13, 2023
    5889d64
    c833bf9
    e46db01
    c68d772
    320ad5e
    128cbf3
  5. added 2 commits that reference this issue on Dec 13, 2023
    a5d4735
    aa6c757
  6. angular-automatic-lock-bot commented on Jan 13, 2024

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  7. locked and limited conversation to collaborators on Jan 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions