cancel
Showing results for 
Search instead for 
Did you mean: 

Approuter localhost Error: Cannot read property 'tokenType' of undefined

LuizGomes
Participant
0 Kudos

ui5.yaml

specVersion: "2.2"
metadata:
name: fv_uimodule
type: application
resources:
configuration:
paths:
webapp: uimodule/webapp
framework:
name: SAPUI5
version: 1.84.0
libraries:
- name: sap.ui.core
- name: sap.m
- name: sap.ui.layout
- name: themelib_sap_fiori_3
server:
customMiddleware:
- name: ui5-middleware-livereload
afterMiddleware: compression
configuration:
port: 35729
path: uimodule/webapp
- name: ui5-middleware-cfdestination
afterMiddleware: compression
configuration:
authenticationMethod: route
debug: true
allowServices: true
port: 5000
xsappJson: ./webapp/xs-app.json
destinations:
- name: 'SPROSalesAppOdata'
url: 'https://sprosalesappbackendapicap-shy-echidna-ci.cfapps.us10.hana.ondemand.com/'

- name: 'screencontrol'
url: 'https://screencontrolapi-cheerful-meerkat-ao.cfapps.us10.hana.ondemand.com/'

- name: 'comercial-approuter'
url: 'https://comercial-approuter-wacky-crane-jc.cfapps.us10.hana.ondemand.com'

builder:
customTasks:
- name: ui5-task-zipper
afterTask: uglify
configuration:
includeDependencies: false
archiveName: uimodule


xs-app.json

{
"authenticationMethod": "route",
"welcomeFile": "/index.html",
"routes": [
{
"source": "^/user-api(.*)",
"target": "$1",
"destination": "comercial-approuter"
}
,{
"source": "^/screencontrol/(.*)",
"target": "$1",
"destination": "screencontrol"
}
,{
"destination": "SPROSalesAppOdata",
"source": "^/SPROSalesAppOdata/(.*)$",
"target": "$1"
}
,{
"source": "^(.*)",
"target": "$1",
"service": "html5-apps-repo-rt"
}
]
}

log

> ui5 serve --config=uimodule/ui5.yaml  --open index.html<br><br>info normalizer:translators:ui5Framework Using SAPUI5 version: 1.84.0<br>#2.0#2022 02 02 08:57:29:094#-03:00#WARNING#/LoggingLibrary################PLAIN##Dynamic log level switching not available#<br>info server:custommiddleware:cfdestination adding cf-like destination "comercial-approuter" proxying reqs to ^/user-api(.*)<br>info server:custommiddleware:cfdestination adding cf-like destination "screencontrol" proxying reqs to ^/screencontrol/(.*)<br>info server:custommiddleware:cfdestination adding cf-like destination "SPROSalesAppOdata" proxying reqs to ^/SPROSalesAppOdata/(.*)$<br>#2.0#2022 02 02 08:57:29:669#-03:00#INFO#/approuter#####kz5hw6o6##########kz5hw6o6#PLAIN##Application router version 10.12.0#<br>#2.0#2022 02 02 08:57:29:674#-03:00#INFO#/Configuration#####kz5hw6oa##########kz5hw6oa#PLAIN##No COOKIES environment variable#<br>info server:custommiddleware:livereload Livereload server started!<br>#2.0#2022 02 02 08:57:29:728#-03:00#INFO#/approuter#####kz5hw6o6##########kz5hw6o6#PLAIN##Application router is listening on port: 5000#<br>Server started<br>URL: http://localhost:8080<br>Feb 02, 2022 08:57:30 AM D:\TRABALHO\SPRO\SPRO\produtos\comercial\SALESFORCE_UI_UI5\node_modules\@sap\approuter\lib\utils\token-utils.js [kz5hw7c1] ERROR: Error getting client_credentials token for html5-apps-repo-rt from subaccount undefined errorRequest failed with status code 401<br>info server:custommiddleware:cfdestination proxying GET /SPROSalesAppOdata/v2/lib/xsodata/service.xsodata/$metadata?sap-language=PT to http://localhost:5000/SPROSalesAppOdata/v2/lib/xsodata/service.xsodata/$metadata?sap-language=PT...<... {<br>  uri: 'http://localhost:5000/SPROSalesAppOdata/v2/lib/xsodata/service.xsodata/$metadata?sap-language=PT',<br>  callback: undefined<br>}<br>REQUEST make request http://localhost:5000/SPROSalesAppOdata/v2/lib/xsodata/service.xsodata/$metadata?sap-language=PT<br>... 02 02 08:57:30:812#-03:00#INFO#/Auth/OAuth2#####cfa850a1-62f5-4faf-90ee-c152087c8118####13PfZMNybd3WQqTCpL3WRwpdl17fY2z1######kz5hw7jl#PLAIN##query does not exist for request url /SPROSalesAppOdata/v2/lib/xsodata/service.xsodata/$metadata?sap-language=PT#<br>#2.0#2022 02 02 08:57:30:813#-03:00#INFO#/Auth/OAuth2#####cfa850a1-62f5-4faf-90ee-c152087c8118####13PfZMNybd3WQqTCpL3WRwpdl17fY2z1######kz5hw7jl#PLAIN##sending page with client-side redirect to https://<omitted for security>.authentication.us10.hana.ondemand.com/oauth/authorize?response_type=code&client_id=sb-forcavendas-authentication!t22482&redirect_uri=http%3A%2F%2Flocalhost%3A5000%2Flogin%2Fcallback#<br>#2.0#2022 02 02 08:57:30:814#-03:00#INFO#/Auth/OAuth2#####cfa850a1-62f5-4faf-90ee-c152087c8118####13PfZMNybd3WQqTCpL3WRwpdl17fY2z1######kz5hw7jl#PLAIN##x-forwarded-path header: undefined#<br>REQUEST onRequestResponse http://localhost:5000/SPROSalesAppOdata/v2/lib/xsodata/service.xsodata/$metadata?sap-language=PT 200 {<br>  'x-request-id': 'kz5hw7jl',<br>  'x-frame-options': 'SAMEORIGIN',<br>  'cache-control': 'no-cache, no-store, must-revalidate',<br>  'content-type': 'text/html',<br>  'content-security-policy': "script-src 'self' 'unsafe-inline'; frame-ancestors *",<br>  date: 'Wed, 02 Feb 2022 11:57:30 GMT',<br>  connection: 'keep-alive',<br>  'content-length': '642'<br>}<br>REQUEST finish init function http://localhost:5000/SPROSalesAppOdata/v2/lib/xsodata/service.xsodata/$metadata?sap-language=PT<br>... response end http://localhost:5000/SPROSalesAppOdata/v2/lib/xsodata/service.xsodata/$metadata?sap-language=PT 200 {<br>  'x-request-id': 'kz5hw7jl',<br>  'x-frame-options': 'SAMEORIGIN',<br>  'cache-control': 'no-cache, no-store, must-revalidate',<br>  'content-type': 'text/html',<br>  'content-security-policy': "script-src 'self' 'unsafe-inline'; frame-ancestors *",<br>  date: 'Wed, 02 Feb 2022 11:57:30 GMT',<br>  connection: 'keep-alive',<br>  'content-length': '642'<br>}<br>info server:custommiddleware:cfdestination proxying GET /user-api/currentUser to http://localhost:5000/user-api/currentUser...<br>REQUEST {<br>  uri: 'http://localhost:5000/user-api/currentUser',<br>  callback: undefined<br>}<br>REQUEST make request http://localhost:5000/user-api/currentUser<br>#2.0#2022 02 02 08:57:31:166#-03:00#ERROR#/Handler#####5cbc24a6-982b-4e07-bb7f-85a44a2d5580####rt63ZS-3rbJW1xKnudDskyOnKA467wxX######kz5hw7to#PLAIN##GET request to /user-api/currentUser completed with status 401 <br>Authentication required#<br>REQUEST onRequestResponse http://localhost:5000/user-api/currentUser 401 {<br>  'x-request-id': 'kz5hw7to',<br>  'x-frame-options': 'SAMEORIGIN',<br>  'cache-control': 'no-cache, no-store, must-revalidate',<br>  date: 'Wed, 02 Feb 2022 11:57:31 GMT',<br>  connection: 'keep-alive',<br>  'transfer-encoding': 'chunked'<br>}<br>REQUEST finish init function http://localhost:5000/user-api/currentUser<br>REQUEST response end http://localhost:5000/user-api/currentUser 401 {<br>  'x-request-id': 'kz5hw7to',<br>  'x-frame-options': 'SAMEORIGIN',<br>  'cache-control': 'no-cache, no-store, must-revalidate',<br>  date: 'Wed, 02 Feb 2022 11:57:31 GMT',<br>  connection: 'keep-alive',<br>  'transfer-encoding': 'chunked'<br>}<br>info server:custommiddleware:cfdestination proxying GET /screencontrol/api/scm_fv/HomeECommerce/create to http://localhost:5000/screencontrol/api/scm_fv/HomeECommerce/create...<br>REQUEST {<br>  uri: 'http://localhost:5000/screencontrol/api/scm_fv/HomeECommerce/create',<br>  callback: undefined<br>}<br>REQUEST make request http://localhost:5000/screencontrol/api/scm_fv/HomeECommerce/create<br>#2.0#2022 02 02 08:57:31:229#-03:00#ERROR#/Handler#####fdc46053-0cb8-42d4-b24a-0e3938e3816c####J6OslV9k53z6FCfzDrRS0cZfw_aJ5Qxm######kz5hw7vg#PLAIN##GET request to /screencontrol/api/scm_fv/HomeECommerce/create completed with status 401 Authentication required#<br>REQUEST onRequestResponse http://localhost:5000/screencontrol/api/scm_fv/HomeECommerce/create 401 {<br>  'x-request-id': 'kz5hw7vg',<br>  'x-frame-options': 'SAMEORIGIN',<br>  'cache-control': 'no-cache, no-store, must-revalidate',<br>  date: 'Wed, 02 Feb 2022 11:57:31 GMT',<br>  connection: 'keep-alive',<br>  'transfer-encoding': 'chunked'<br>}<br>REQUEST finish init function http://localhost:5000/screencontrol/api/scm_fv/HomeECommerce/create<br>REQUEST response end http://localhost:5000/screencontrol/api/scm_fv/HomeECommerce/create 401 {<br>  'x-request-id': 'kz5hw7vg',<br>  'x-frame-options': 'SAMEORIGIN',<br>  'cache-control': 'no-cache, no-store, must-revalidate',<br>  date: 'Wed, 02 Feb 2022 11:57:31 GMT',<br>  connection: 'keep-alive',<br>  'transfer-encoding': 'chunked'<br>}<br>#2.0#2022 02 02 08:57:38:585#-03:00#INFO#/Auth/OAuth2#####5190775c-12bf-46b8-944f-36c185879081####W956o0UJaEi3cA1ss3vhWMj8W31VbYO_######kz5hwdjs#PLAIN##query does not exist for request url /screencontrol/api/scm_fv/HomeECommerce/create#<br>#2.0#2022 02 02 08:57:38:585#-03:00#INFO#/Auth/OAuth2#####5190775c-12bf-46b8-944f-36c185879081####W956o0UJaEi3cA1ss3vhWMj8W31VbYO_######kz5hwdjs#PLAIN##sending page with client-side redirect to https://<omitted for security>.authentication.us10.hana.ondemand.com/oauth/authorize?response_type=code&client_id=sb-forcavendas-authentication!t22482&redirect_uri=http%3A%2F%2Flocalhost%3A5000%2Flogin%2Fcallback#<br>#2.0#2022 02 02 08:57:38:586#-03:00#INFO#/Auth/OAuth2#####5190775c-12bf-46b8-944f-36c185879081####W956o0UJaEi3cA1ss3vhWMj8W31VbYO_######kz5hwdjs#PLAIN##x-forwarded-path header: undefined#<br>#2.0#2022 02 02 08:57:39:688#-03:00#ERROR#/Handler#####62d6d8e8-dd85-4b55-8e82-712069d2e363####M5qdvYXh9lWFuuR6WIRgV3UH45w5qSea######kz5hweec#PLAIN##GET request to /screencontrol/api/scm_fv/HomeECommerce/create completed with status 500 Cannot read property 'tokenType' of undefined#<br>#2.0#2022 02 02 08:57:49:389#-03:00#INFO#/Auth/OAuth2#####61529c21-b395-4667-8b2e-8ade1855b7ee####RtjGF1Bdg8zKxhfwuBnMphPyI42mnKEz######kz5hwlvu#PLAIN##query does not exist for request url /screencontrol/api/scm_fv/HomeECommerce/create#<br>#2.0#2022 02 02 08:57:49:390#-03:00#INFO#/Auth/OAuth2#####61529c21-b395-4667-8b2e-8ade1855b7ee####RtjGF1Bdg8zKxhfwuBnMphPyI42mnKEz######kz5hwlvu#PLAIN##sending page with client-side redirect to https://sprohanacloudsub.authentication.us10.hana.ondemand.com/oauth/authorize?response_type=code&cl... 02 02 08:57:49:390#-03:00#INFO#/Auth/OAuth2#####61529c21-b395-4667-8b2e-8ade1855b7ee####RtjGF1Bdg8zKxhfwuBnMphPyI42mnKEz######kz5hwlvu#PLAIN##x-forwarded-path header: undefined#<br>#2.0#2022 02 02 08:58:15:010#-03:00#ERROR#/Handler#####a3fe4cbb-24f2-48e7-97db-6b3f7690641c####kr9lNKq7mPk0HV2XjcHPk1UlvSM_xlcL######kz5hx5nk#PLAIN##GET request to /screencontrol/api/scm_fv/HomeECommerce/create completed with status 500 Cannot read property 'tokenType' of undefined#<br>#2.0#2022 02 02 08:58:15:067#-03:00#ERROR#/Handler#####c22c660c-5b19-4eee-b8b8-741bda0dce5f####kr9lNKq7mPk0HV2XjcHPk1UlvSM_xlcL######kz5hx5p5#PLAIN##GET request to /favicon.ico/index.html completed with status 500 Cannot read property 'tokenType' of undefined#

error only occurs on localhost. on portal or launchpad works normally.

the destination commercial-approuter working normally

Accepted Solutions (1)

Accepted Solutions (1)

LuizGomes
Participant
0 Kudos

I remove service html5-apps-repo-rt in xs-app.json and default-env.json. working in localhost

Answers (0)