Skip to content

Server-side data fetching is failing in Microsoft Windows environment #591

Closed
@omarbelkhodja

Description

Please provide the environment you discovered this bug in.

You need to run the analog-app on Windows 11:
pnpm exec nx run analog-app:serve --skip-nx-cache

Which area/package is the issue in?

vite-plugin-nitro

Description

I have tried to run the analog-app application, but the application fails to start, because of errors related to Server-Side data fetching. Some debugging showed the *.server.ts files are not detected, because the path is not normalized in
https://github.com/analogjs/analog/blob/main/packages/vite-plugin-nitro/src/lib/utils/get-page-handlers.ts#L14

Please provide the exception or error you saw

The '@analogjs/platform' successfully started.
The server endpoints are accessible under the "/api" path.
  ➜  Local:   http://localhost:3000/
  ➜  Network: use --host to expose
Angular is running in development mode.
NavigationError {
  id: 1,
  url: '/',
  error: HttpErrorResponse {
    headers: HttpHeaders {
      normalizedNames: Map(0) {},
      lazyUpdate: null,
      lazyInit: [Function (anonymous)]
    },
    status: 404,
    statusText: 'Not Found',
    url: 'http://localhost:3000/api/_analog/pages/-home-',
    ok: false,
    name: 'HttpErrorResponse',
    message: 'Http failure response for http://localhost:3000/api/_analog/pages/-home-: 404 Not Found',
    error: {
      url: '/_analog/pages/-home-',
      statusCode: 404,
      statusMessage: 'Cannot find any route matching /_analog/pages/-home-.',
      message: 'Cannot find any route matching /_analog/pages/-home-.'
    }
  },
  target: RouterStateSnapshot {
    _root: TreeNode { value: [ActivatedRouteSnapshot], children: [Array] },
    url: '/'
  },
  type: 3
}
ERROR Error: Uncaught (in promise): HttpErrorResponse: {"headers":{"normalizedNames":{},"lazyUpdate":null},"status":404,"statusText":"Not Found","url":"http://localhost:3000/api/_analog/pages/-home-","ok":false,"name":"HttpErrorResponse","message":"Http failure response for http://localhost:3000/api/_analog/pages/-home-: 404 Not Found","error":{"url":"/_analog/pages/-home-","statusCode":404,"statusMessage":"Cannot find any route matching /_analog/pages/-home-.","message":"Cannot find any route matching /_analog/pages/-home-."}}
    at resolvePromise (E:\git\analog\node_modules\.pnpm\zone.js@0.13.1\node_modules\zone.js\bundles\zone-node.umd.js:1179:35)
    at resolvePromise (E:\git\analog\node_modules\.pnpm\zone.js@0.13.1\node_modules\zone.js\bundles\zone-node.umd.js:1133:21)
    at E:\git\analog\node_modules\.pnpm\zone.js@0.13.1\node_modules\zone.js\bundles\zone-node.umd.js:1246:21
    at _ZoneDelegate.invokeTask (E:\git\analog\node_modules\.pnpm\zone.js@0.13.1\node_modules\zone.js\bundles\zone-node.umd.js:446:35)
    at AsyncStackTaggingZoneSpec.onInvokeTask (E:/git/analog/node_modules/.pnpm/@angular+core@16.1.0_rxjs@7.8.0_zone.js@0.13.1/node_modules/@angular/core/fesm2022/core.mjs:25949:28)  
    at _ZoneDelegate.invokeTask (E:\git\analog\node_modules\.pnpm\zone.js@0.13.1\node_modules\zone.js\bundles\zone-node.umd.js:445:64)
    at Object.onInvokeTask (E:/git/analog/node_modules/.pnpm/@angular+core@16.1.0_rxjs@7.8.0_zone.js@0.13.1/node_modules/@angular/core/fesm2022/core.mjs:26247:33)
    at _ZoneDelegate.invokeTask (E:\git\analog\node_modules\.pnpm\zone.js@0.13.1\node_modules\zone.js\bundles\zone-node.umd.js:445:64)
    at Zone.runTask (E:\git\analog\node_modules\.pnpm\zone.js@0.13.1\node_modules\zone.js\bundles\zone-node.umd.js:211:51)
    at drainMicroTaskQueue (E:\git\analog\node_modules\.pnpm\zone.js@0.13.1\node_modules\zone.js\bundles\zone-node.umd.js:635:39) {
  rejection: HttpErrorResponse {
    headers: HttpHeaders {
      normalizedNames: Map(0) {},
      lazyUpdate: null,
      lazyInit: [Function (anonymous)]
    },
    status: 404,
    statusText: 'Not Found',
    url: 'http://localhost:3000/api/_analog/pages/-home-',
    ok: false,
    name: 'HttpErrorResponse',
    message: 'Http failure response for http://localhost:3000/api/_analog/pages/-home-: 404 Not Found',
    error: {
      url: '/_analog/pages/-home-',
      statusCode: 404,
      statusMessage: 'Cannot find any route matching /_analog/pages/-home-.',
      message: 'Cannot find any route matching /_analog/pages/-home-.'
    }
  },
  promise: ZoneAwarePromise [Promise] {
    __zone_symbol__state: 0,
    __zone_symbol__value: HttpErrorResponse {
      headers: [HttpHeaders],
      status: 404,
      statusText: 'Not Found',
      url: 'http://localhost:3000/api/_analog/pages/-home-',
      ok: false,
      name: 'HttpErrorResponse',
      message: 'Http failure response for http://localhost:3000/api/_analog/pages/-home-: 404 Not Found',
      error: [Object]
    }
  },
  zone: <ref *1> Zone {
    _parent: Zone {
      _parent: [Zone],
      _name: 'asyncStackTagging for Angular',
      _properties: {},
      _zoneDelegate: [_ZoneDelegate]
    },
    _name: 'angular',
    _properties: { isAngularZone: true },
    _zoneDelegate: <ref *2> _ZoneDelegate {
      _taskCounts: [Object],
      zone: [Circular *1],
      _parentDelegate: [_ZoneDelegate],
      _forkZS: null,
      _forkDlgt: null,
      _forkCurrZone: null,
      _interceptZS: null,
      _interceptDlgt: null,
      _interceptCurrZone: null,
      _invokeZS: [Object],
      _invokeDlgt: [_ZoneDelegate],
      _invokeCurrZone: [Circular *1],
      _handleErrorZS: [Object],
      _handleErrorDlgt: [_ZoneDelegate],
      _handleErrorCurrZone: [Circular *1],
      _scheduleTaskZS: [Object],
      _scheduleTaskDlgt: [_ZoneDelegate],
      _scheduleTaskCurrZone: [Circular *1],
      _invokeTaskZS: [Object],
      _invokeTaskDlgt: [_ZoneDelegate],
      _invokeTaskCurrZone: [Circular *1],
      _cancelTaskZS: [Object],
      _cancelTaskDlgt: [_ZoneDelegate],
      _cancelTaskCurrZone: [Circular *1],
      _hasTaskZS: [Object],
      _hasTaskDlgt: [_ZoneDelegate],
      _hasTaskDlgtOwner: [Circular *2],
      _hasTaskCurrZone: [Circular *1]
    }
  },
  task: ZoneTask {
    _zone: <ref *1> Zone {
      _parent: [Zone],
      _name: 'angular',
      _properties: [Object],
      _zoneDelegate: [_ZoneDelegate]
    },
    runCount: 0,
    _zoneDelegates: null,
    _state: 'notScheduled',
    type: 'microTask',
    source: 'Promise.then',
    data: ZoneAwarePromise [Promise] {
      __zone_symbol__state: 0,
      __zone_symbol__value: [HttpErrorResponse]
    },
    scheduleFn: undefined,
    cancelFn: undefined,
    callback: [Function (anonymous)],
    invoke: [Function (anonymous)],
    consoleTask: null
  }
}
`

Other information

No response

I would be willing to submit a PR to fix this issue

  • Yes
  • No

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions