Simulator: run new simulator behind proxy

Created on 12 Sep 2019  路  15Comments  路  Source: lgsvl/simulator

Hello. When I run new simulator , I find a problem. I have a proxy locally.
After I enter the user name and password, the page will keep in "loading" but not go into normal UI. If I don't use proxy, everythings go fine. But using proxy is necessary.
I think there is somethings in web missing the proxy when try to check password and username in the backend online.
Thank you in advanced for help.

Most helpful comment

We do not have solution for this now, but we are aware of issue and it is in our backlog to fix it.

All 15 comments

Hello, I have the same problem.

I tried to run the WebUI using "npm run serve" and it produces the same error. When trying to access localhost:8081 in Firefox, I get this web console output:
Navigated to http://localhost:8081/ Download the React DevTools for a better development experience: https://fb.me/react-devtools react-dom.development.js:21258 Token detected: null App.js:35 Checkhing current user... App.js:47 another error happened:Request failed with status code 500 APIs.js:26 Getting the user: Object { data: "Proxy error: Could not proxy request /users from localhost:8081 to http://localhost:8080 (ECONNREFUSED).", status: 500, statusText: "Internal Server Error", headers: {鈥, config: {鈥, request: XMLHttpRequest } App.js:50 Require authentication in the cloud Object { data: "Proxy error: Could not proxy request /users from localhost:8081 to http://localhost:8080 (ECONNREFUSED).", status: 500, statusText: "Internal Server Error", headers: {鈥, config: {鈥, request: XMLHttpRequest } App.js:55 Failed to get user information App.js:62 XML Parsing Error: syntax error Location: http://localhost:8081/users Line Number 1, Column 1: users:1:1 ./src/components/SimulationManager/FormMapVehicles.js Line 126: 'vehicleList' is already declared in the upper scope no-shadow webpackHotDevClient.js:138 The development server has disconnected. Refresh the page if necessary. webpackHotDevClient.js:76

The terminal running the server shows this:
Compiled with warnings. ./src/components/SimulationManager/FormMapVehicles.js Line 126: 'vehicleList' is already declared in the upper scope no-shadow Search for the keywords to learn more about each warning. To ignore, add // eslint-disable-next-line to the line before. Proxy error: Could not proxy request /users from localhost:8081 to http://localhost:8080. See https://nodejs.org/api/errors.html#errors_common_system_errors for more information (ECONNREFUSED). Proxy error: Could not proxy request /sockjs-node/153/0wgqg4el/websocket from localhost:8081 to http://localhost:8080. See https://nodejs.org/api/errors.html#errors_common_system_errors for more information (ECONNREFUSED).

Building the WebUI in Unity makes no difference. I also tried defining a constant token directly in app.js, this makes the page reload all the time.
Is there a way to run the simulator without user authentification?

Do you need to run WebUI through npm? Because that is needed only when you do development on UI. Normally you just run Simulator from unity and it will serve WebUI directly - there is no need to run npm serve.

Do you get same error when access WebUI directly on 8080 port?

Oh yeah, I forgot to mention, the same happens when running it the normal way, through Unity or from the standalone version, on different machines.
Only used npm for testing.

Sometimes after clearing cookies I get through to the login page somehow, get the token but then the same error happens

And the proxy environment variables are set on the machine. I also tried to set npm proxy settings directly, and to change settings in packages.json, but no difference.

It always tries to access the 'localhost/user' directory which doesn't exist

Am 13. September 2019 20:04:45 MESZ schrieb Martins Mozeiko notifications@github.com:

Do you need to run WebUI through npm? Because that is needed only when
you do development on UI. Normally you just run Simulator from unity
and it will serve WebUI directly - there is no need to run npm serve.

Do you get same error when access WebUI directly on 8080 port?

--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/lgsvl/simulator/issues/360#issuecomment-531335695

Ok, we'll look into this.

@martins-mozeiko Excuse me, are there current way to solve proxy problem or run the simulator without user authentification? I check for a while. May be it is problem of axios in react. https://github.com/axios/axios/issues/1679
I will continue to figure out this problem .Thank you

We do not have solution for this now, but we are aware of issue and it is in our backlog to fix it.

@Roman-jj @Kailiangdong I believe I know what is your problem. Find config.yml file next to simulator.exe or in your source tree if you are building simulator from source and make sure, hostname is set to "*", not localhost. npm run serve proxy does not forward requests to localhost.

hostname: "*"
port: 8080
headless: false
read_only: false
api_hostname: "localhost"
api_port: 8181

Could you please confirm that this solved your problem.

Hi, thanks for your suggestion, unfortunately it didn't solve the issue.
We're using a workaround through mobile network atm.

We're using a workaround through mobile network atm

Browser console output when starting from Unity and after logging into account.lgsvlsimulator.com:

Token detected: 1b9a0c17-137a-4479-9283-5fed4b4fd670
main.js:86284:13 Updating user with token...
main.js:86294:17 Source map error: request failed with status 404
Resource URL: http://localhost:8080/main.js
Source Map URL: main.js.map

and Unity console:

Refresh: detecting if any assets need to be imported or removed ...

Refresh Completed time: 0.071414s
Asset Scan time: 0.070571s
Asset Hashing: 0.000000s [0 B, 0.000000 mb/s]
Asset Import (Scripting) time: 0.000000s (count: 0)
Post Processs Assets (Scripting) time: 0.000000s
Asset Rehashing: 0.000000s [0 B, 0.000000 mb/s]
Asset Import (Non Scripting) time: 0.000000s (count: 0)
Post Process Assets (Non Scripting) time: 0.000000s
Dependent Assets to Import Queue time: 0.000000s

Reloading assemblies for play mode.
Begin MonoManager ReloadAssembly
Initializing Extension Manager v2019.1.10 for Unity v2019.1.10f1
Registering platform support modules:
Registered platform support modules in: 0.1098298s.
Native extension for LinuxStandalone target not found
Refreshing native plugins compatible for Editor in 1.92 ms, found 4 plugins.
Preloading 0 native plugins for Editor in 0.00 ms.
Mono: successfully reloaded assembly
Unhandled description string =
Unhandled description string -
Unhandled description string TAB
Unhandled description string TAB

    Completed reload, in 2.880 seconds
    Platform modules already initialized, skipping
    Load scene 'Temp/__Backupscenes/0.backup' time: 0.264598 ms
    Current Database Version: 1
    UnityEngine.DebugLogHandler:Internal_Log(LogType, LogOption, String, Object)
    UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
    UnityEngine.Logger:Log(LogType, Object)
    UnityEngine.Debug:Log(Object)
    Simulator.Database.DatabaseManager:CheckForPatches() (at Assets/Scripts/Database/DatabaseManager.cs:132)
    Simulator.Database.DatabaseManager:Init() (at Assets/Scripts/Database/DatabaseManager.cs:91)
    Simulator.Loader:Start() (at Assets/Scripts/Web/Loader.cs:120)

(Filename: Assets/Scripts/Database/DatabaseManager.cs Line: 132)

Final Database Version: 1
UnityEngine.DebugLogHandler:Internal_Log(LogType, LogOption, String, Object)
UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
UnityEngine.Logger:Log(LogType, Object)
UnityEngine.Debug:Log(Object)
Simulator.Database.DatabaseManager:CheckForPatches() (at Assets/Scripts/Database/DatabaseManager.cs:168)
Simulator.Database.DatabaseManager:Init() (at Assets/Scripts/Database/DatabaseManager.cs:91)
Simulator.Loader:Start() (at Assets/Scripts/Web/Loader.cs:120)

(Filename: Assets/Scripts/Database/DatabaseManager.cs Line: 168)

NullReferenceException: Object reference not set to an instance of an object
at SimulatorManagerEditor.LogPlayModeState (UnityEditor.PlayModeStateChange state) [0x00047] in /lhome/joerger/LGSVL/simulator/Assets/Scripts/Editor/SimulatorManagerEditor.cs:35
at (wrapper delegate-invoke) System.Action`1[UnityEditor.PlayModeStateChange].invoke_void_T(UnityEditor.PlayModeStateChange)
at UnityEditor.EditorApplication.Internal_PlayModeStateChanged (UnityEditor.PlayModeStateChange state) [0x00025] in /home/builduser/buildslave/unity/build/Editor/Mono/EditorApplication.cs:302

(Filename: Assets/Scripts/Editor/SimulatorManagerEditor.cs Line: 35)

Getting current user
UnityEngine.DebugLogHandler:Internal_Log(LogType, LogOption, String, Object)
UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
UnityEngine.Logger:Log(LogType, Object)
UnityEngine.Debug:Log(Object)
Simulator.Web.Modules.<>c__DisplayClass0_0:<.ctor>b__0(Object) (at Assets/Scripts/Web/Modules/UsersModule.cs:61)
Nancy.<>c__DisplayClass14_01:<Get>b__0(Object) Nancy.<>c__DisplayClass16_01:b__0(Object, CancellationToken)
Nancy.Routing.d__7:MoveNext()
System.Runtime.CompilerServices.AsyncTaskMethodBuilder1:Start(<Invoke>d__7&) Nancy.Routing.Route1:Invoke(DynamicDictionary, CancellationToken)
Nancy.Routing.d__2:MoveNext()
System.Runtime.CompilerServices.AsyncTaskMethodBuilder1:Start(<Invoke>d__2&) Nancy.Routing.DefaultRouteInvoker:Invoke(Route, CancellationToken, DynamicDictionary, NancyContext) Nancy.Routing.<Dispatch>d__5:MoveNext() System.Runtime.CompilerServices.AsyncTaskMethodBuilder1:Start(d__5&)
Nancy.Routing.DefaultRequestDispatcher:Dispatch(NancyContext, CancellationToken)
Nancy.d__22:MoveNext()
System.Runtime.CompilerServices.AsyncTaskMethodBuilder1:Start(<InvokeRequestLifeCycle>d__22&) Nancy.NancyEngine:InvokeRequestLifeCycle(NancyContext, CancellationToken, IPipelines) Nancy.<HandleRequest>d__15:MoveNext() System.Runtime.CompilerServices.AsyncTaskMethodBuilder1:Start(d__15&)
Nancy.NancyEngine:HandleRequest(Request, Func2, CancellationToken) Nancy.NancyEngineExtensions:HandleRequest(INancyEngine, Request) Nancy.Hosting.Self.<Process>d__27:MoveNext() System.Runtime.CompilerServices.AsyncTaskMethodBuilder:Start(<Process>d__27&) Nancy.Hosting.Self.NancyHost:Process(HttpListenerContext) Nancy.Hosting.Self.<<Start>b__1>d:MoveNext() System.Runtime.CompilerServices.AsyncTaskMethodBuilder:Start(<<Start>b__1>d&) Nancy.Hosting.Self.<>c__DisplayClass14_0:<Start>b__1(Task1)
System.Threading.Tasks.ContinuationResultTaskFromResultTask`2:InnerInvoke()
System.Threading.Tasks.Task:Execute()
System.Threading.Tasks.Task:ExecutionContextCallback(Object)
System.Threading.ExecutionContext:RunInternal(ExecutionContext, ContextCallback, Object, Boolean)
System.Threading.ExecutionContext:Run(ExecutionContext, ContextCallback, Object, Boolean)
System.Threading.Tasks.Task:ExecuteWithThreadLocal(Task&)
System.Threading.Tasks.Task:ExecuteEntry(Boolean)
System.Threading.Tasks.Task:System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
System.Threading.ThreadPoolWorkQueue:Dispatch()
System.Threading._ThreadPoolWaitCallback:PerformWaitCallback()

(Filename: Assets/Scripts/Web/Modules/UsersModule.cs Line: 61)

Updating user with token
UnityEngine.DebugLogHandler:Internal_Log(LogType, LogOption, String, Object)
UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
UnityEngine.Logger:Log(LogType, Object)
UnityEngine.Debug:Log(Object)
Simulator.Web.Modules.<<-ctor>b__1>d:MoveNext() (at Assets/Scripts/Web/Modules/UsersModule.cs:84)
System.Runtime.CompilerServices.AsyncTaskMethodBuilder1:Start(<<-ctor>b__1>d&) Simulator.Web.Modules.<>c__DisplayClass0_0:<.ctor>b__1(Object) Nancy.<>c__DisplayClass46_01:b__0(Object, CancellationToken)
Nancy.Routing.d__7:MoveNext()
System.Runtime.CompilerServices.AsyncTaskMethodBuilder1:Start(<Invoke>d__7&) Nancy.Routing.Route1:Invoke(DynamicDictionary, CancellationToken)
Nancy.Routing.d__2:MoveNext()
System.Runtime.CompilerServices.AsyncTaskMethodBuilder1:Start(<Invoke>d__2&) Nancy.Routing.DefaultRouteInvoker:Invoke(Route, CancellationToken, DynamicDictionary, NancyContext) Nancy.Routing.<Dispatch>d__5:MoveNext() System.Runtime.CompilerServices.AsyncTaskMethodBuilder1:Start(d__5&)
Nancy.Routing.DefaultRequestDispatcher:Dispatch(NancyContext, CancellationToken)
Nancy.d__22:MoveNext()
System.Runtime.CompilerServices.AsyncTaskMethodBuilder1:Start(<InvokeRequestLifeCycle>d__22&) Nancy.NancyEngine:InvokeRequestLifeCycle(NancyContext, CancellationToken, IPipelines) Nancy.<HandleRequest>d__15:MoveNext() System.Runtime.CompilerServices.AsyncTaskMethodBuilder1:Start(d__15&)
Nancy.NancyEngine:HandleRequest(Request, Func2, CancellationToken) Nancy.NancyEngineExtensions:HandleRequest(INancyEngine, Request) Nancy.Hosting.Self.<Process>d__27:MoveNext() System.Runtime.CompilerServices.AsyncTaskMethodBuilder:Start(<Process>d__27&) Nancy.Hosting.Self.NancyHost:Process(HttpListenerContext) Nancy.Hosting.Self.<<Start>b__1>d:MoveNext() System.Runtime.CompilerServices.AsyncTaskMethodBuilder:Start(<<Start>b__1>d&) Nancy.Hosting.Self.<>c__DisplayClass14_0:<Start>b__1(Task1)
System.Threading.Tasks.ContinuationResultTaskFromResultTask`2:InnerInvoke()
System.Threading.Tasks.Task:Execute()
System.Threading.Tasks.Task:ExecutionContextCallback(Object)
System.Threading.ExecutionContext:RunInternal(ExecutionContext, ContextCallback, Object, Boolean)
System.Threading.ExecutionContext:Run(ExecutionContext, ContextCallback, Object, Boolean)
System.Threading.Tasks.Task:ExecuteWithThreadLocal(Task&)
System.Threading.Tasks.Task:ExecuteEntry(Boolean)
System.Threading.Tasks.Task:System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
System.Threading.ThreadPoolWorkQueue:Dispatch()
System.Threading._ThreadPoolWaitCallback:PerformWaitCallback()

(Filename: Assets/Scripts/Web/Modules/UsersModule.cs Line: 84)

and then a TaskCancelledException

I am also facing exactly the same problem when I start LGSVL simulator under proxy. I would appreciate if you find the solution to the problem.

Dear all,
Use Proxifier app on your computer will solve this problem.

Any update on this proxy issue? I have the same proplem and cannot avoid the proxy...

Please help me, I also have to use the simulator behind proxy and I am facing the same question.

Please help me, I also have to use the simulator behind proxy and I am facing the same question.

Do you try "Proxifier " this software?

Please help me, I also have to use the simulator behind proxy and I am facing the same question.

Do you try "Proxifier " this software?

Yes I just downloaded it, can you tell me how to use it? And my mail address is [email protected] , thanks a lot!!

Hi, I am running into this LGSVL limitation with Proxy. I am unable to use Proxifier or any other alternative tool. I would like to be able to run the simulator without user authentication or for this proxy issue to be fixed. Do you have plans to permanently fix this issue?

Was this page helpful?
0 / 5 - 0 ratings