jpwahle / cs-insights-backend

API server of the cs-insights project. This is the main part of storing data and accessing an external data analysis endpoint. It uses a mongoDB instance to store everything and queries the cs-insights-prediction-endpoint to get machine learning results.
https://jpwahle.github.io/cs-insights-backend/
MIT License
7 stars 0 forks source link

TypeScript checks in commit pipeline do not match checks in docker-compose #61

Closed trannel closed 2 years ago

trannel commented 2 years ago

Describe the bug TypeScript checking fails during the build stage of docker-compose --env-file=.env.production up --build, even though all checks passed after the commit. Executing the npm run build (with or without --production) and tsc -p . manually also does not throw any errors. TypeScript appears to be stricter during the docker compose, than in every other place.

To Reproduce Steps to reproduce the behavior:

  1. Run git checkout dev
  2. Run git checkout 04127932abd90856f3993f980221ab0ab1f2dbf7
  3. Complete steps in README for production setup including docker-compose --env-file=.env.production up --build
  4. See error, when the script executes tsc -p . during its build stage.
  5. Run npm run build to see no error
  6. Run tsc -p . to see no error

Alternative steps to reproduce the behavior:

  1. Run git checkout fix_docker_compose
  2. Navigate to src/types.ts
  3. Navigate to type FilterMongo
  4. Remove at least one | { $ne: null }
  5. Continue with Step 3 "Complete steps ..." from the first steps to reproduce

Expected behavior The TypeScript checks should already fail in the commit pipeline. Additionally, both npm run build and tsc -p . should also fail and show the same errors, when I run them in a terminal on my machine.

Screenshots image These errors should be fixed in #62

Desktop (please complete the following information):

jpwahle commented 2 years ago

I will try to reproduce this behavior on my machine. Probably typescript version mismatch or smth? Before it always passed. We should include testing this in the pipeline, can you open an issue for it? So next time we know which commit broke it.

trannel commented 2 years ago

I updated the issue with more information and a second way to reproduce the issue.

TypeScript versions are all 4.7.4 on my machine, except for the express-oas-generator: image

During docker compose it is the same: image

jpwahle commented 2 years ago

The issue is that NODE_ENV is set to prodocutionin docker which is the expected behavior. The test pipelines are set to developmentwhich is the default. Therefore the typescript compiler is not as strict.