scoreboard icon indicating copy to clipboard operation
scoreboard copied to clipboard

User Extent of Edits map is broken local development

Open guidorice opened this issue 4 years ago • 0 comments

To reproduce this problem,

  • run scoreboard locally with yarn dev or yarn dev-static.
  • browse to any user's profile page
  • look at the map
  • inspect the network dev tools, and see 404 not found errors for the .mvt tiles

It seems like this might have been a regression, Screen Shot 2020-08-18 at 1 45 23 PM

Possible improvement

  • [ ] Add aws localstack and s3 service to the docker-compose development environment. Improve yarn seed scripts to mock up some mvt tiles for each user in the seed database.
  • [ ] Yank out the mocked tile services in api/src/index.js
  • [ ] Modify api/src/routes/extents.js to use the localstack s3 during local dev

Workaround

It looks like the 404 not found is being caused by the mocked up tile service having the user parameter hardcoded to test which is too restrictive:

> git diff
diff --git a/api/src/index.js b/api/src/index.js
index d063d6a..ca5794c 100644
--- a/api/src/index.js
+++ b/api/src/index.js
@@ -76,7 +76,7 @@ module.exports = async function () {
 
   if (NODE_ENV === 'development') {
     let tiles = await mbtiles(path.join(__dirname, 'db', 'earthquakes.mbtiles'))
-    app.get(['/api/extents/user/test/:z/:x/:y.mvt', '/scoreboard/api/extents/user/test/:z/:x/:y.mvt'], (req, res) => {
+    app.get(['/api/extents/user/:user/:z/:x/:y.mvt', '/scoreboard/api/extents/user/:user/:z/:x/:y.mvt'], (req, res) => {
       var p = req.params
       tiles.getTile(p.z, p.x, p.y, function (err, tile, headers) {
         if (err) {

cc @necoline @jvntf

guidorice avatar Aug 18 '20 20:08 guidorice