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

Never returns status 404 Not Found which causes error "Uncaught SyntaxError: Unexpected token <" #345

Closed
1 of 6 tasks
mauriciolauffer opened this issue Jul 18, 2018 · 2 comments
Labels
duplicate This issue or pull request already exists module/ui5-server Related to the UI5 Server module

Comments

@mauriciolauffer
Copy link

Expected Behavior

It should return status 404 Not Found for files not found.

Current Behavior

If a file is not found, it always returns status 200 OK and an HTML file as response.

Steps to reproduce the issue

  1. Get the project: https://github.com/mauriciolauffer/ui5-tooling-test
  2. Run $ ui5 serve -o index.html
  3. If you open http://localhost:8080/resources/sap/m/library-preload.js it will return an HTML page instead of a 404 Not Found error.

Context

  • OS/Platform: Windows 10
  • Node.js Version: 8.11.3
  • npm Version: 6.2.0
  • Browser (if relevant): IE/Edge/Chrome/Firefox

Affected components

Stack trace/log output: js erros in Chrome

library-preload.js:1 Uncaught SyntaxError: Unexpected token <

Log.js?eval:414 2018-07-18 10:28:02.897199 failed to load 'sap/ui/layout/library-preload.js' (Unexpected token <), falling back to library-preload.json -  
log @ Log.js?eval:414
Log.error @ Log.js?eval:204
Logger.error @ Log.js?eval:475
(anonymous) @ Core.js?eval:1458
Promise.then (async)
preloadLibraryAsync @ Core.js?eval:1450
Core.loadLibraries @ Core.js?eval:1811
(anonymous) @ Interface.js?eval:44
preloadDependencies @ Component.js?eval:2483
(anonymous) @ Component.js?eval:2749
Promise.then (async)
(anonymous) @ Component.js?eval:2742
Promise.then (async)
loadComponent @ Component.js?eval:2739
componentFactory @ Component.js?eval:2076
Component.create @ Component.js?eval:1927
(anonymous) @ index.html:29
(anonymous) @ ui5loader.js:1690
setTimeout (async)
(anonymous) @ ui5loader.js:1689
requireAll @ ui5loader.js:1492
fnRequire @ ui5loader.js:1683
(anonymous) @ index.html:25
(anonymous) @ Core.js?eval:1215
Core._executeInitListeners @ Core.js?eval:1214
Core.init @ Core.js?eval:1077
(anonymous) @ Core.js?eval:347
finish @ SyncPoint.js?eval:59
SyncPoint.finishTask @ SyncPoint.js?eval:53
(anonymous) @ Core.js?eval:362
(anonymous) @ Core.js?eval:767
Promise.then (async)
Core._boot @ Core.js?eval:766
(anonymous) @ Core.js?eval:361
finish @ SyncPoint.js?eval:59
SyncPoint.finishTask @ SyncPoint.js?eval:53
(anonymous) @ Core.js?eval:436
Promise.then (async)
constructor @ Core.js?eval:435
(anonymous) @ Core.js?eval:3898
(anonymous) @ ui5loader.js:1605
requireAll @ ui5loader.js:1492
defineModule @ ui5loader.js:1585
ui5Define @ ui5loader.js:1568
(anonymous) @ Core.js?eval:8
execModule @ ui5loader.js:1399
requireModule @ ui5loader.js:1288
requireSync @ ui5loader.js:1812
(anonymous) @ index.html:18

Log.js?eval:414 2018-07-18 10:28:02.918800 failed to load '/resources/sap/ui/layout/library-preload.json': undefined -  
log @ Log.js?eval:414
Log.error @ Log.js?eval:204
Logger.error @ Log.js?eval:475
(anonymous) @ Core.js?eval:1545
Promise.then (async)
loadJSONAsync @ Core.js?eval:1529
(anonymous) @ Core.js?eval:1459
Promise.then (async)
preloadLibraryAsync @ Core.js?eval:1450
Core.loadLibraries @ Core.js?eval:1811
(anonymous) @ Interface.js?eval:44
preloadDependencies @ Component.js?eval:2483
(anonymous) @ Component.js?eval:2749
Promise.then (async)
(anonymous) @ Component.js?eval:2742
Promise.then (async)
loadComponent @ Component.js?eval:2739
componentFactory @ Component.js?eval:2076
Component.create @ Component.js?eval:1927
(anonymous) @ index.html:29
(anonymous) @ ui5loader.js:1690
setTimeout (async)
(anonymous) @ ui5loader.js:1689
requireAll @ ui5loader.js:1492
fnRequire @ ui5loader.js:1683
(anonymous) @ index.html:25
(anonymous) @ Core.js?eval:1215
Core._executeInitListeners @ Core.js?eval:1214
Core.init @ Core.js?eval:1077
(anonymous) @ Core.js?eval:347
finish @ SyncPoint.js?eval:59
SyncPoint.finishTask @ SyncPoint.js?eval:53
(anonymous) @ Core.js?eval:362
(anonymous) @ Core.js?eval:767
Promise.then (async)
Core._boot @ Core.js?eval:766
(anonymous) @ Core.js?eval:361
finish @ SyncPoint.js?eval:59
SyncPoint.finishTask @ SyncPoint.js?eval:53
(anonymous) @ Core.js?eval:436
Promise.then (async)
constructor @ Core.js?eval:435
(anonymous) @ Core.js?eval:3898
(anonymous) @ ui5loader.js:1605
requireAll @ ui5loader.js:1492
defineModule @ ui5loader.js:1585
ui5Define @ ui5loader.js:1568
(anonymous) @ Core.js?eval:8
execModule @ ui5loader.js:1399
requireModule @ ui5loader.js:1288
requireSync @ ui5loader.js:1812
(anonymous) @ index.html:18

library.js?eval:1 Uncaught (in promise) SyntaxError: Unexpected token <
    at eval (<anonymous>)
    at execModule (ui5loader.js:1399)
    at requireModule (ui5loader.js:1288)
    at requireAll (ui5loader.js:1474)
    at Object.fnRequire [as require] (ui5loader.js:1683)
    at eval (Core.js?eval:1797)
    at new Promise (<anonymous>)
    at requireLibsAsync (Core.js?eval:1796)

Stack trace/log output: $ ui5 serve --verbose

:\zdev\ui5-tooling-test>ui5 init
Wrote ui5.yaml to C:\zdev\ui5-tooling-test\ui5.yaml:

specVersion: '0.1'
metadata:
  name: ui5-tooling-test

C:\zdev\ui5-tooling-test>ui5 serve --verbose
verb cli:middlewares:base using node version v8.11.3
verb normalizer:normalizer Building dependency tree...
verb normalizer:translators:npm Analyzing ui5-tooling-test (C:\zdev\ui5-tooling-test) (dependency of nothing - root project)
verb normalizer:translators:npm Analyzing @openui5/sap.m (C:\zdev\ui5-tooling-test\node_modules\@openui5\sap.m) (dependency of ui5-tooling-test)
verb normalizer:translators:npm Analyzing @openui5/sap.ui.core (C:\zdev\ui5-tooling-test\node_modules\@openui5\sap.ui.core) (dependency of ui5-tooling-test)
verb normalizer:translators:npm Analyzing @openui5/themelib_sap_belize (C:\zdev\ui5-tooling-test\node_modules\@openui5\themelib_sap_belize) (dependency of ui5-tooling-test)
verb normalizer:translators:npm Analyzing @openui5/sap.ui.unified (C:\zdev\ui5-tooling-test\node_modules\@openui5\sap.ui.unified) (dependency of @openui5/sap.m)
verb normalizer:translators:npm [PERF] Consider defining UI5-dependencies in the package.json files of the relevant modules from the following list to improve npm translator execution time: ui5-tooling-test, @o
penui5/sap.m, @openui5/sap.ui.core, @openui5/themelib_sap_belize, @openui5/sap.ui.unified
verb normalizer:translators:npm Built tree:
verb normalizer:translators:npm { id: 'ui5-tooling-test',
verb normalizer:translators:npm   version: '0.0.1',
verb normalizer:translators:npm   path: 'C:\\zdev\\ui5-tooling-test',
verb normalizer:translators:npm   dependencies:
erb normalizer:translators:npm    [ { id: '@openui5/sap.m',
verb normalizer:translators:npm        version: '1.56.4',
verb normalizer:translators:npm        path: 'C:\\zdev\\ui5-tooling-test\\node_modules\\@openui5\\sap.m',
verb normalizer:translators:npm        dependencies: [Array] },
verb normalizer:translators:npm      { id: '@openui5/sap.ui.core',
verb normalizer:translators:npm        version: '1.56.4',
verb normalizer:translators:npm        path: 'C:\\zdev\\ui5-tooling-test\\node_modules\\@openui5\\sap.ui.core',
verb normalizer:translators:npm        dependencies: [] },
verb normalizer:translators:npm      { id: '@openui5/themelib_sap_belize',
verb normalizer:translators:npm        version: '1.56.4',
verb normalizer:translators:npm        path: 'C:\\zdev\\ui5-tooling-test\\node_modules\\@openui5\\themelib_sap_belize',
verb normalizer:translators:npm        dependencies: [] } ] }
verb normalizer:projectPreprocessor Dependency of project @openui5/sap.m, "@openui5/sap.ui.core": Distance to root of 2. Will be replaced by project with same ID and distance to root of 2.
verb normalizer:projectPreprocessor Dependency of project @openui5/themelib_sap_belize, "@openui5/sap.m": Distance to root of 2. Will be replaced by project with same ID and distance to root of 2.
verb normalizer:projectPreprocessor Dependency of project @openui5/themelib_sap_belize, "@openui5/sap.ui.core": Distance to root of 2. Will be replaced by project with same ID and distance to root of 2.
verb normalizer:projectPreprocessor Dependency of project @openui5/themelib_sap_belize, "@openui5/sap.ui.unified": Distance to root of 2. Will be replaced by project with same ID and distance to root of 2.
verb normalizer:projectPreprocessor Dependency of project @openui5/sap.ui.unified, "@openui5/sap.ui.core": Distance to root of 3. Will be replaced by project with same ID and distance to root of 3.
verb types:application:ApplicationFormatter Formatting project ui5-tooling-test...
verb types:library:LibraryFormatter Could not find (optional) test directory of project @openui5/sap.m: C:\zdev\ui5-tooling-test\node_modules\@openui5\sap.m\src
verb types:library:LibraryFormatter Formatting project sap.m...
verb types:library:LibraryFormatter Ignoring 'test' directory for project sap.m.Either no setting was provided or the path not found.
verb types:library:LibraryFormatter Could not find (optional) test directory of project @openui5/sap.ui.core: C:\zdev\ui5-tooling-test\node_modules\@openui5\sap.ui.core\src
verb types:library:LibraryFormatter Formatting project sap.ui.core...
erb types:library:LibraryFormatter Ignoring 'test' directory for project sap.ui.core.Either no setting was provided or the path not found.
verb types:library:LibraryFormatter Could not find (optional) test directory of project @openui5/themelib_sap_belize: C:\zdev\ui5-tooling-test\node_modules\@openui5\themelib_sap_belize\src
verb types:library:LibraryFormatter Formatting project themelib_sap_belize...
verb types:library:LibraryFormatter Ignoring 'test' directory for project themelib_sap_belize.Either no setting was provided or the path not found.
verb types:library:LibraryFormatter Could not find (optional) test directory of project @openui5/sap.ui.unified: C:\zdev\ui5-tooling-test\node_modules\@openui5\sap.ui.unified\src
verb types:library:LibraryFormatter Formatting project sap.ui.unified...
verb types:library:LibraryFormatter Ignoring 'test' directory for project sap.ui.unified.Either no setting was provided or the path not found.
verb normalizer:projectPreprocessor Processed 5 projects in 29 ms
Server started
URL: http://localhost:8080

Stack trace/log output: $ ui5 tree

C:\zdev\ui5-tooling-test>ui5 tree
├─ id: ui5-tooling-test
├─ version: 0.0.1
├─ path: C:\zdev\ui5-tooling-test
└─ dependencies
   ├─ 0
   │  ├─ id: @openui5/sap.m
   │  ├─ version: 1.56.4
   │  ├─ path: C:\zdev\ui5-tooling-test\node_modules\@openui5\sap.m
   │  └─ dependencies
   │     ├─ 0
   │     │  ├─ id: @openui5/sap.ui.core
   │     │  ├─ version: 1.56.4
   │     │  ├─ path: C:\zdev\ui5-tooling-test\node_modules\@openui5\sap.ui.core
   │     │  └─ dependencies
   │     └─ 1
   │        ├─ id: @openui5/sap.ui.unified
   │        ├─ version: 1.56.4
   │        ├─ path: C:\zdev\ui5-tooling-test\node_modules\@openui5\sap.ui.unified
   │        └─ dependencies
   │           └─ 0
   │              ├─ id: @openui5/sap.ui.core
   │              ├─ version: 1.56.4
   │              ├─ path: C:\zdev\ui5-tooling-test\node_modules\@openui5\sap.ui.core
   │              └─ dependencies
   ├─ 1
   │  ├─ id: @openui5/sap.ui.core
   │  ├─ version: 1.56.4
   │  ├─ path: C:\zdev\ui5-tooling-test\node_modules\@openui5\sap.ui.core
   │  └─ dependencies
   └─ 2
      ├─ id: @openui5/themelib_sap_belize
      ├─ version: 1.56.4
      ├─ path: C:\zdev\ui5-tooling-test\node_modules\@openui5\themelib_sap_belize
      └─ dependencies
         ├─ 0
         │  ├─ id: @openui5/sap.m
         │  ├─ version: 1.56.4
         │  ├─ path: C:\zdev\ui5-tooling-test\node_modules\@openui5\sap.m
         │  └─ dependencies
         │     ├─ 0
         │     │  ├─ id: @openui5/sap.ui.core
         │     │  ├─ version: 1.56.4
         │     │  ├─ path: C:\zdev\ui5-tooling-test\node_modules\@openui5\sap.ui.core
         │     │  └─ dependencies
         │     └─ 1
         │        ├─ id: @openui5/sap.ui.unified
         │        ├─ version: 1.56.4
         │        ├─ path: C:\zdev\ui5-tooling-test\node_modules\@openui5\sap.ui.unified
         │        └─ dependencies
         │           └─ 0
         │              ├─ id: @openui5/sap.ui.core
         │              ├─ version: 1.56.4
         │              ├─ path: C:\zdev\ui5-tooling-test\node_modules\@openui5\sap.ui.core
         │              └─ dependencies
         ├─ 1
         │  ├─ id: @openui5/sap.ui.core
         │  ├─ version: 1.56.4
         │  ├─ path: C:\zdev\ui5-tooling-test\node_modules\@openui5\sap.ui.core
         │  └─ dependencies
         └─ 2
           ├─ id: @openui5/sap.ui.unified
            ├─ version: 1.56.4
            ├─ path: C:\zdev\ui5-tooling-test\node_modules\@openui5\sap.ui.unified
            └─ dependencies
               └─ 0
                  ├─ id: @openui5/sap.ui.core
                  ├─ version: 1.56.4
                  ├─ path: C:\zdev\ui5-tooling-test\node_modules\@openui5\sap.ui.core
                  └─ dependencies
@matz3
Copy link
Member

matz3 commented Jul 18, 2018

What version of the @ui5/cli are you using?
This sounds like the same issue as SAP/ui5-server#39 which was fixed with SAP/ui5-server#40 and is part of @ui5/cli v0.2.1 (released yesterday).

To update the CLI, just run

npm install -g @ui5/cli

@mauriciolauffer
Copy link
Author

I was on @ui5/cli 0.2.0, I've updated to 0.2.1 now. It's working, it returns 404.
Thanks @matz3

@matz3 matz3 closed this as completed Jul 18, 2018
@RandomByte RandomByte transferred this issue from SAP/ui5-server Nov 20, 2020
@RandomByte RandomByte added duplicate This issue or pull request already exists module/ui5-server Related to the UI5 Server module labels Nov 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists module/ui5-server Related to the UI5 Server module
Projects
None yet
Development

No branches or pull requests

3 participants