hastic-zzz / hastic-server

Hastic data management server for analyzing patterns and anomalies from Grafana
GNU General Public License v3.0
330 stars 23 forks source link

Build error - Type 'Record<string, unknown>' is missing the following properties from type AnalyticUnit #947

Closed arunbenoyv closed 3 years ago

arunbenoyv commented 3 years ago

Docker file https://github.com/hastic/hastic-server/blob/master/server/Dockerfile

We are seeing the following error in docker build

15:03:01 ERROR in /var/www/server/src/routes/analytic_units_router.ts 15:03:01 ./src/routes/analytic_units_router.ts 15:03:01 [tsl] ERROR in /var/www/server/src/routes/analytic_units_router.ts(61,27) 15:03:01 TS2352: Conversion of type 'string | Record<string, unknown>' to type 'AnalyticUnit' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first. 15:03:01 Type 'Record<string, unknown>' is missing the following properties from type 'AnalyticUnit': learningAfterUpdateRequired, name, grafanaUrl, panelId, and 5 more.

mstapfner commented 3 years ago

I'm experiencing the same issues:

#13 52.73 ERROR in /var/www/server/src/routes/analytic_units_router.ts
#13 52.73 ./src/routes/analytic_units_router.ts
#13 52.73 [tsl] ERROR in /var/www/server/src/routes/analytic_units_router.ts(61,27)
#13 52.73       TS2352: Conversion of type 'string | Record<string, unknown>' to type 'AnalyticUnit' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
#13 52.73   Type 'Record<string, unknown>' is missing the following properties from type 'AnalyticUnit': learningAfterUpdateRequired, name, grafanaUrl, panelId, and 5 more.
#13 52.85 npm ERR! code ELIFECYCLE
#13 52.85 npm ERR! errno 2
#13 52.86 npm ERR! hastic-server@0.5.1 build: `webpack --config build/webpack.prod.conf.js`
#13 52.86 npm ERR! Exit status 2
#13 52.86 npm ERR! 
#13 52.86 npm ERR! Failed at the hastic-server@0.5.1 build script.
#13 52.86 npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
#13 52.88 
#13 52.88 npm ERR! A complete log of this run can be found in:
#13 52.88 npm ERR!     /root/.npm/_logs/2021-06-15T14_59_52_862Z-debug.log
mstapfner commented 3 years ago

Okay so i just checked this issue again, this has nothing to do with Docker, it is a typescript conversion error. I pushed a fix for that into my personal forks: https://github.com/mstapfner/hastic-server and https://github.com/mstapfner/hastic-analytics

i cannot guarantee that everything works, but now the docker build is working and the containers can start.

I suggest renaming this issue to a general build error, because it doesn't relate to docker @arunbenoyv

mstapfner commented 3 years ago

@rozetko should i reach in a pr for this?

rozetko commented 3 years ago

@mstapfner sure, we'd appreciate it!

rozetko commented 3 years ago

Fixed in https://github.com/hastic/hastic-server/pull/948