The problem is that you add a layer to the map before loading the map. Make sure you attach the tile source and style layer in the load event handler.
afterMap.on('load', function() { afterMap.addSource("points", { "type": "geojson", "data": nyGeo }) afterMap.addLayer({ "id": "points", "type": "symbol", "source": "points", "layout": { "icon-image": "{icon}-15", "text-field": "{title}", "text-font": ["Open Sans Semibold", "Arial Unicode MS Bold"], "text-offset": [0, 0.6], "text-anchor": "top" } }); });
source share