By Developers, For Developers

Historical errata for Real-Time Phoenix

PDF PgPaper PgTypeDescriptionFixed onComments
40SUGGEST

The diagram refers to the payload field , the text below refers to the same field as Message. While this is understandable it is not consistent.

2019-08-29Thanks for this report! The next beta update will have it fixed.
125SUGGEST

In the PDF version, Line 18 of the “sneakers_23/test/sneakers_23_web/channels/product_channel_test.exs” test code has the final \\ (backslash) still in italics which kind of makes it look like the | (pipe) character. Suggest changing the final \\ from italic font to normal font so that it matches the format of the opening backslash.

This caught me out briefly when I was quickly transcribing the code and the test failed when I used | instead of \\ (yeah, yeah I know….doh)

2019-09-02Thanks for this report! The next beta update will remove the \\ completely. It is not needed because of ~s.
10?TYPO

The improvements in the communication
layer has enabled a wave of modern applications that satisfy real-time needs of users.

Stephen Bussey. Real-Time Phoenix (Kindle Locations 186-187).

Should be ‘have’

2019-10-08Thanks for this report! The next beta update will have it fixed. \n
20ERROR

I receive a 426 response, not a 101 response:
[mike@oldpond hello_sockets]$ curl -i ‘hyperlink removed for errata’ -H…
HTTP/1.1 426 Upgrade Required
cache-control: max-age=0, private, must-revalidate
connection: upgrade
content-length: 0
date: Wed, 16 Oct 2019 17:43:28 GMT
server: Cowboy
upgrade: websocket

2019-10-16Thanks for this report. \n \nI dug into it and the intent is that everything after -H is kept (so your request will be multiple lines long in your console). The headers that come with it allow for the WebSocket protocol to be used. \n \nI'll look at making this more clear in the text. \n \n-sb
20SUGGEST

I followed the instructions to “copy as curl” and got the correct response. I did not have to replace “ws:” with “http:”; this was the default. I am using Firefox devtools.

2019-10-16Thanks for this suggestion. I'm going to leave it as is because the correct end result from the book example is achieved. \n \n-sb
42ERROR

There is an issue between the mobi and pdf versions. The diagrams are not getting filled in with the mobi version. The boxes appear, but there is not text inside the boxes.

2020-01-02Hi Michael, \n \nI see what you mean and I will be working on a fix. The change takes a bit longer than others, so it might be in B7 or B8. \n \n- sb
45SUGGEST

In the mobi version, “pong” and “pang” appear to my old eyes as almost identical in the code samples. I would suggest using something more distinct.

2019-12-20We've moved from "pang" to "ding"! Thanks for the feedback. \n \n- sb
154ERROR

when killing Sneakers23Web.Endpoint via :observer, the output
[info] Application sneakers_23 exited: shutdown
is received in the iex repl, and the sneakers_23 application disappears from :observer’s listed application.

Erlang/OTP 22 [erts-10.4.4] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [hipe]
Interactive Elixir (1.9.1) - press Ctrl+C to exit (type h() ENTER for help)

2019-12-20Thanks! This may be an issue with the Endpoint supervisor. I've brought it up for questions, but future versions of the book will not have this instruction set. \n \n- sb
11ERROR

Hi! Thank you for your work

I’ve found some errors in the code which maybe could be solved.

lib/hello_sockets/pipeline/producer.ex the handle_cast function should be agrouped
lib/hello_sockets/pipeline/worker.ex start_link function are duplicated with same arity
lib/hello_sockets_web/templates/page/index.html.eex on the bottom of the file the markup (<%) cause the error

Best regards, Oscar

2019-11-11Thanks for this report. This is a byproduct of the way that code is included in the book. The book's content evolves over a chapter, but each stage has to be represented in the book. \n \nI will be going through the code to add end statements to all functions in the book. The end result will still have some duplicate functions though.
1265ERROR

The same issue reported before in B3 also appears in B6 on Epub version (I’ve only tested epub and pdf for now). Basically the diagrams are not getting filled in on the epub version as well, the boxes appear but there is nothing inside. It seems like they only display properly on the PDF versions.

2020-01-08Hi Igor, \n \nThis change took several betas to get resolved. Mobi and epub images will look correct in the next beta release (B7.0). Thanks for the report! \n \n-Steve
102ERROR

“We spawn an unlinked Task”
In the code example there’s Task.start_link/1 function that starts a process linked to the current process.
Therefore you should either replace “unlinked” with “linked” or use Task.start/1 instead.

2020-02-25Thanks for this report! This will be fixed in the next version (which will be the production release). \n \nIt will say "linked". \n \n- Steve
72OK

A pattern matching statement in the code block at the bottom of the page is reversed. Currently, the third parameter of the join method reads:

socket = %{assigns: %{user_id: user_id}}

I believe it should read:

%{assigns: %{user_id: user_id}} = socket

Thanks for a great book!

2020-04-08Thanks for this report. In my personal development, I always put the variable assignment before the pattern, rather than after. \n \nYou do run the potential of seeing it both ways in the book, but both are syntactically correct and will have the same end result. You can change it in your code to the one that you prefer.
31OK

In the initial definition of the HelloSocketsWeb.PingChannel, the join function has an unused topic argument (_topic). Should this not be the topic name (“ping”).

defmodule​ HelloSocketsWeb.PingChannel ​do​
​ \t ​use​ Phoenix.Channel
​ \t
​ \t ​def​ join(_topic, _payload, socket) ​do​
​ \t {​:ok​, socket}
​ \t ​end​
​ \t​end​

2020-04-08In this case, it could be the topic name or an unused argument. We will expand the PingChannel with additional topics in the future, so limiting it to "ping" would be an issue. \n \nIn general, I would suggest doing the routing at the Socket layer (via a channel definition) and only pattern match on the topic name if you need to do authorization based on it (covered in a later chapter). For example, if I had a Channel with 5 different topics and none of them had special join needs, I would allow them to use the same join function via a _topic argument.
1840ERROR

Hello,

Thank you for the book! I learnt a lot.

I was looking at test for shopping cart channel. Found a random test failure on sneakers_23_cart folder from the code download. I ran this command:
`
mix test test/sneakers_23_web/channels/shopping_cart_channel_test.exs
`
and this scenario fails randomly: “test handle_in remove_item the PubSub subscription for the item is removed”

If you run that test 2-10 times you should able to reproduce.

For some reason, even an item was removed from the cart it still receives “cart” event.

Does this mean that unsubscribe doesn’t work sometimes on item removal from cart?

Regards,
Ruslan.

2020-04-15Thanks for this report Ruslan. I was happy to be able to chat with you further about it. \n \nThere does seem to be some sort of race condition that is reproducible on your machine but not mine or some others. This may be a legitimate issues with the code. I would suggest adding another call to wait_until_messages_processed after the channel is joined in the "handle_in remove_item the PubSub subscription for the item is removed" test. \n \nI am not going to suggest any changes to the content at this point because I have not been able to reproduce this.
32OK

Hi, at
‘< [“1”,“2”,“ping”,“phx_reply”,{response
If you encounter any errors like “unmatched topic” when you run this example,
make sure that your UserSocket module has only the ping Channel route listed.’
The description of neccesary functioncalls in the javascript files is missing. I am getting an “unmatched topic” error because of this, not because of the lack of listing of the route in the UserSocket module.

2020-04-16The book does not introduce the JavaScript client at this point--only wscat is used until the end of chapter 3. Any unmatched topic errors at this point are from the Elixir side, so you should double check that the code is entered correctly. If you get stuck, you can go to the file in the code download to see what I entered.
127OK

After adding test for notify_product_relese i get the following error when running mix test

Compilation error in file test/sneakers_23_web/channels/product_channel_test.exs

(DBConnection.OwnershipError) cannot find ownership process for #PID<0.411.0>.

When using ownership, you must manage connections in one
of the four ways:

  • By explicitly checking out a connection
  • By explicitly allowing a spawned process
  • By running the pool in shared mode
  • By using :caller option with allowed process

The first two options require every new process to explicitly
check a connection out or be allowed by calling checkout or
allow respectively.

The third option requires a {:shared, pid} mode to be set.
If using shared mode in tests, make sure your tests are not
async.

The fourth option requires [caller: pid] to be used when
checking out a connection from the pool. The caller process
should already be allowed on a connection.

If you are reading this error, it means you have not done one
of the steps above or that the owner process has crashed.

See Ecto.Adapters.SQL.Sandbox docs for more information.
(ecto_sql 3.1.6) lib/ecto/adapters/sql.ex:618: Ecto.Adapters.SQL.raise_sql_call_error/1
(ecto 3.1.7) lib/ecto/repo/schema.ex:649: Ecto.Repo.Schema.apply/4
(ecto 3.1.7) lib/ecto/repo/schema.ex:262: anonymous fn/15 in Ecto.Repo.Schema.do_insert/4
(ecto 3.1.7) lib/ecto/repo/schema.ex:164: Ecto.Repo.Schema.insert!/4
(sneakers_23 0.1.0) test/support/factory/inventory_factory.ex:14: Test.Factory.InventoryFactory.complete_products/0
test/sneakers_23_web/channels/product_channel_test.exs:7: (module)
(stdlib 3.12) erl_eval.erl:680: :erl_eval.do_apply/6
(elixir 1.10.2) lib/kernel/parallel_compiler.ex:396: Kernel.ParallelCompiler.require_file/2
(elixir 1.10.2) lib/kernel/parallel_compiler.ex:306: anonymous fn/4 in Kernel.ParallelCompiler.spawn_workers/7

2020-04-25Please check that your file is using ChannelCase and not ExUnit.Case. This is the most likely culprit that was missed. \n \nThe example in the book has source code provided as well. You can look there to see it working and what you might have missed. The book code has confirmed to work if all steps are followed. \n \nBest \nSteve

Categories: