Skip to content

Mock NationBuilder's events for development environment #30

@ben-pr-p

Description

@ben-pr-p

Right now, running the code locally produces

[info] JOIN events to Core.EventsChannel
  Transport:  Phoenix.Transports.WebSocket
  Parameters: %{}
[info] Replied events :ok
[error] GenServer #PID<0.512.0> terminating
** (Protocol.UndefinedError) protocol Enumerable not implemented for nil. This protocol is implemented for: DBConnection.PrepareStream, DBConnection.Stream, Date.Range, Ecto.Adapters.SQL.Stream, File.Stream, Flow, Function, GenEvent.Stream, HashDict, HashSet, IO.Stream, List, Map, MapSet, Postgrex.Stream, Range, Stream, Timex.Interval
    (elixir) lib/enum.ex:1: Enumerable.impl_for!/1
    (elixir) lib/enum.ex:116: Enumerable.reduce/3
    (elixir) lib/enum.ex:1832: Enum.map/2
    (core) web/channels/events_channel.ex:19: Core.EventsChannel.handle_in/3
    (phoenix) lib/phoenix/channel/server.ex:226: anonymous fn/4 in Phoenix.Channel.Server.handle_info/2
    (stdlib) gen_server.erl:616: :gen_server.try_dispatch/4
    (stdlib) gen_server.erl:686: :gen_server.handle_msg/6
    (stdlib) proc_lib.erl:247: :proc_lib.init_p_do_apply/3
Last message: %Phoenix.Socket.Message{event: "ready", payload: %{}, ref: "34", topic: "events"}
State: %Phoenix.Socket{assigns: %{}, channel: Core.EventsChannel, channel_pid: #PID<0.512.0>, endpoint: Core.Endpoint, handler: Core.UserSocket, id: nil, joined: true, pubsub_server: Core.PubSub, ref: nil, serializer: Phoenix.Transports.WebSocketSerializer, topic: "events", transport: Phoenix.Transports.WebSocket, transport_name: :websocket, transport_pid: #PID<0.479.0>}

which is an error produced by trying to fetch events from the staging Nation Builder.

Fix options include:
– Reading events from a local cache when MIX_ENV=dev
– Giving the staging environment a read only api key for the production nationbuilder
– Setting up the staging nationbuilder to have events, which would unforunately require the login which we do not have.

Local cache solution can come first

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions