Closed Nesqwik closed 2 years ago
For every app that I launch using this new system i get an error. It seems that it reproduces the same error that is happening on the current beta version of the node12-template when opening the app the first time. The error should disappear after refreshing the page but it is not the case here anymore.
@Nesqwik Is there any change required to do to an app to work with this system ?
08:09:29.238 [error] Task #PID<0.3982.0> started from #PID<0.3971.0> terminating
** (FunctionClauseError) no function clause matching in ApplicationRunner.WidgetCache.build_component/4
(application_runner 0.0.0-dev) lib/session/widget_cache.ex:82: ApplicationRunner.WidgetCache.build_component(%ApplicationRunner.SessionState{assigns: %{socket_pid: #PID<0.3970.0>}, env_id: 1, function_name: "test", inactivity_timeout: 600000, session_id: "7e84a85a-359e-47e2-b5d0-d4e12c50ae9c", session_supervisor_pid: #PID<0.3972.0>, user_id: 1}, %{}, %ApplicationRunner.UiContext{listeners_map: %{}, widgets_map: %{}}, %ApplicationRunner.WidgetContext{data: [%{"_datastore" => "_users", "_id" => 2, "_refBy" => [], "_refs" => [], "_user" => %{"email" => "user1@devtools.lenra.io", "id" => 1}}], id: "SNy5UrOg0P6/vSBpbvXP07CC4wBJE4n+w2GQWFStIFs=", name: "redirect", prefix_path: "/children/1/child", props: nil})
(application_runner 0.0.0-dev) lib/session/widget_cache.ex:70: ApplicationRunner.WidgetCache.get_and_build_widget/3
(application_runner 0.0.0-dev) lib/session/widget_cache.ex:132: ApplicationRunner.WidgetCache.handle_widget/4
(application_runner 0.0.0-dev) lib/session/widget_cache.ex:276: ApplicationRunner.WidgetCache.build_comp_and_format/8
(elixir 1.12.2) lib/enum.ex:2385: Enum."-reduce/3-lists^foldl/2-0-"/3
(application_runner 0.0.0-dev) lib/session/widget_cache.ex:227: ApplicationRunner.WidgetCache.build_child_list/5
(application_runner 0.0.0-dev) lib/session/widget_cache.ex:166: ApplicationRunner.WidgetCache.handle_component/5
(elixir 1.12.2) lib/task/supervised.ex:90: Task.Supervised.invoke_mfa/2
Function: #Function<1.53326239/0 in Parallel.map/2>
Args: []
08:09:29.245 [error] GenServer #PID<0.3972.0> terminating
** (FunctionClauseError) no function clause matching in ApplicationRunner.WidgetCache.build_component/4
(application_runner 0.0.0-dev) lib/session/widget_cache.ex:82: ApplicationRunner.WidgetCache.build_component(%ApplicationRunner.SessionState{assigns: %{socket_pid: #PID<0.3970.0>}, env_id: 1, function_name: "test", inactivity_timeout: 600000, session_id: "7e84a85a-359e-47e2-b5d0-d4e12c50ae9c", session_supervisor_pid: #PID<0.3972.0>, user_id: 1}, %{}, %ApplicationRunner.UiContext{listeners_map: %{}, widgets_map: %{}}, %ApplicationRunner.WidgetContext{data: [%{"_datastore" => "_users", "_id" => 2, "_refBy" => [], "_refs" => [], "_user" => %{"email" => "user1@devtools.lenra.io", "id" => 1}}], id: "SNy5UrOg0P6/vSBpbvXP07CC4wBJE4n+w2GQWFStIFs=", name: "redirect", prefix_path: "/children/1/child", props: nil})
(application_runner 0.0.0-dev) lib/session/widget_cache.ex:70: ApplicationRunner.WidgetCache.get_and_build_widget/3
(application_runner 0.0.0-dev) lib/session/widget_cache.ex:132: ApplicationRunner.WidgetCache.handle_widget/4
(application_runner 0.0.0-dev) lib/session/widget_cache.ex:276: ApplicationRunner.WidgetCache.build_comp_and_format/8
(elixir 1.12.2) lib/enum.ex:2385: Enum."-reduce/3-lists^foldl/2-0-"/3
(application_runner 0.0.0-dev) lib/session/widget_cache.ex:227: ApplicationRunner.WidgetCache.build_child_list/5
(application_runner 0.0.0-dev) lib/session/widget_cache.ex:166: ApplicationRunner.WidgetCache.handle_component/5
(elixir 1.12.2) lib/task/supervised.ex:90: Task.Supervised.invoke_mfa/2
Last message: {:EXIT, #PID<0.3971.0>, {:function_clause, [{ApplicationRunner.WidgetCache, :build_component, [%ApplicationRunner.SessionState{assigns: %{socket_pid: #PID<0.3970.0>}, env_id: 1, function_name: "test", inactivity_timeout: 600000, session_id: "7e84a85a-359e-47e2-b5d0-d4e12c50ae9c", session_supervisor_pid: #PID<0.3972.0>, user_id: 1}, %{}, %ApplicationRunner.UiContext{listeners_map: %{}, widgets_map: %{}}, %ApplicationRunner.WidgetContext{data: [%{"_datastore" => "_users", "_id" => 2, "_refBy" => [], "_refs" => [], "_user" => %{"email" => "user1@devtools.lenra.io", "id" => 1}}], id: "SNy5UrOg0P6/vSBpbvXP07CC4wBJE4n+w2GQWFStIFs=", name: "redirect", prefix_path: "/children/1/child", props: nil}], [file: 'lib/session/widget_cache.ex', line: 82]}, {ApplicationRunner.WidgetCache, :get_and_build_widget, 3, [file: 'lib/session/widget_cache.ex', line: 70]}, {ApplicationRunner.WidgetCache, :handle_widget, 4, [file: 'lib/session/widget_cache.ex', line: 132]}, {ApplicationRunner.WidgetCache, :build_comp_and_format, 8, [file: 'lib/session/widget_cache.ex', line: 276]}, {Enum, :"-reduce/3-lists^foldl/2-0-", 3, [file: 'lib/enum.ex', line: 2385]}, {ApplicationRunner.WidgetCache, :build_child_list, 5, [file: 'lib/session/widget_cache.ex', line: 227]}, {ApplicationRunner.WidgetCache, :handle_component, 5, [file: 'lib/session/widget_cache.ex', line: 166]}, {Task.Supervised, :invoke_mfa, 2, [file: 'lib/task/supervised.ex', line: 90]}]}}
For every app that I launch using this new system i get an error. It seems that it reproduces the same error that is happening on the current beta version of the node12-template when opening the app the first time. The error should disappear after refreshing the page but it is not the case here anymore.
How do you start the devtool to test this branch ? I just tested it and i have no error at all...
Sure ! :)
:tada: This PR is included in version 1.0.0-beta.51 :tada:
The release is available on:
v1.0.0-beta.51
Your semantic-release bot :package::rocket:
:tada: This PR is included in version 1.0.0-mongo.1 :tada:
The release is available on:
v1.0.0-mongo.1
Your semantic-release bot :package::rocket:
:tada: This PR is included in version 1.0.0-mongo.1 :tada:
The release is available on:
v1.0.0-mongo.1
Your semantic-release bot :package::rocket:
:tada: This PR is included in version 1.0.0-alpha.1 :tada:
The release is available on:
v1.0.0-alpha.1
Your semantic-release bot :package::rocket:
https://github.com/lenra-io/application-runner/pull/176 is merged and the dependancy is udpated. We can merge.
Checklist
Description of the changes
The main idea is to dynamically create a user based on an ID. This id is given from the dev to the client via the query params : http://localhost:4000?user=42
This will send the userId: 42 to the server via the websocket join param. The back-end will create the corresponding user and load the session using this user.
Technical highlight/advice
I had to change the applicationRunner
resource_from_token
callback to accept the full param object. I also had to handle the routes in the client to be able to keep theuser=42
query param in the url.