Why is this db_select not working? I can't seem to figure out, are you not allowed to chain db_select methods?

$nid = db_select("node", "n")
            -&gt;fields("n", array("nid"))
            -&gt;condition("f.entity_type", "node", "=")
            -&gt;condition("f.deleted", 0, "=")
            -&gt;condition("f.field_products_product_id", $entity-&gt;product_id, "=")
            -&gt;addTag("node_access")
            -&gt;join(
                "field_data_field_products",
                "f",
                "f.entity_id = n.nid"
            )
            -&gt;execute();


I have the above, and it just won't work it keeps erroring on the join. Basically I want to do

SELECT nid FROM node JOIN field_data_field_products ON entity_id = nid WHERE ...
This is answered in this other question:

How to perform join with multiple columns using db_select?


  Calls to SelectQuery::join() (like-wise SelectQuery::leftJoin(),
  SelectQuery::innerJoin(), and SelectQuery::addJoin()) chain-able
  because those methods don't return a SelectQuery object, but the
  actual alias used for the join.