Greenstand / Greenstand/treetracker-web-map-api

Can not run db cluster script successfully

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

Description

Script: assign-new-trees-to-clusters.js
will throw error when running to this place:

https://github.com/Greenstand/treetracker-web-map-api/blob/055e384a7c02e8bedda2f7c4fc88488a51416b45/src/cron/assign-new-trees-to-clusters.js#L92-L101

The error:
```
9962 error: permission denied for materialized view active_tree_region
9963 ¦ at Connection.parseE (/root/treetracker-web-map/node_modules/pg/lib/connection.js:546:11)
9964 ¦ at Connection.parseMessage (/root/treetracker-web-map/node_modules/pg/lib/connection.js:371:19)
9965 ¦ at TLSSocket. (/root/treetracker-web-map/node_modules/pg/lib/connection.js:114:22)
9966 ¦ at TLSSocket.emit (events.js:310:20)
9967 ¦ at addChunk (_stream_readable.js:286:12)
9968 ¦ at readableAddChunk (_stream_readable.js:268:9)
9969 ¦ at TLSSocket.Readable.push (_stream_readable.js:209:10)
9970 ¦ at TLSWrap.onStreamRead (internal/stream_base_commons.js:186:23)
9971 (node:4212) UnhandledPromiseRejectionWarning: ReferenceError: client is not defined
9972 ¦ at /root/treetracker-web-map/src/cron/assign-new-trees-to-clusters.js:158:5
9973 ¦ at processTicksAndRejections (internal/process/task_queues.js:97:5)
9974 (node:4212) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by thro
9975 wing inside of an async function without a catch block, or by rejecting a promise which was not handled with .c
9976 atch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=
9977 strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
9978 (node:4212) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise r
9979 ejections that are not handled will terminate the Node.js process with a non-zero exit code.
```

To manually run it in psql:
```
10013 treetracker=> REFRESH MATERIALIZED VIEW CONCURRENTLY active_tree_region;
10014 ERROR: permission denied for materialized view active_tree_region
10015 CONTEXT: SQL statement "DELETE FROM public.active_tree_region mv WHERE ctid OPERATOR(pg_catalog.=) ANY (SELECT
10016 diff.tid FROM pg_temp_10.pg_temp_22060_2 diff WHERE diff.tid IS NOT NULL AND diff.newdata IS NULL)"
10017 treetracker=> \q
10018 root@map-api:~/treetracker-web-map# psql postgresql://treetracker:xi7w7jb5m5xxn4m1@db-postgresql-sfo2-40397-do-
10019 user-1067699-0.db.ondigitalocean.com:25060/treetracker?ssl=true
10020 psql (10.16 (Ubuntu 10.16-0ubuntu0.18.04.1), server 11.11)
10021 WARNING: psql major version 10, server major version 11.
10022 ¦ ¦ ¦ ¦Some psql features might not work.
10023 SSL connection (protocol: TLSv1.3, cipher: TLS_AES_256_GCM_SHA384, bits: 256, compression: off)
10024 Type "help" for help.
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.