developmentseed / developmentseed/scoreboard

User Extent of Edits map is broken local development

Open
#596 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
JavaScript
Stars
27
Forks
8
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.