IBM / template-node-typescript

Github Template that uses TypeScript with Node.js to create a BFF or Microservice API with Open API Specification
Apache License 2.0
71 stars 41 forks source link

Tekton Pipeline fails at build stage for the new toolkit version and new igc version on a vpc cluster #10

Open RamyaRaghuveera opened 4 years ago

RamyaRaghuveera commented 4 years ago

Describe the bug Tekton Pipeline fails at build stage for the new toolkit version and new igc version on a vpc cluster with the following error: src/server.ts(81,48): error TS2769: No overload matches this call. The last overload gave the following error. Argument of type '(err: any) => void' is not assignable to parameter of type '() => void'. npm ERR! code ELIFECYCLE npm ERR! errno 2 npm ERR! template-node-typescript@1.0.0 build: tsc npm ERR! Exit status 2 npm ERR! npm ERR! Failed at the template-node-typescript@1.0.0 build script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above. npm ERR! A complete log of this run can be found in: npm ERR! /opt/app-root/src/.npm/_logs/2020-09-16T11_28_04_439Z-debug.log

This error is caused as app.listen fails. As app.listen fails, the callback function tries to capture the error. app.listen doesnot return error(https://stackoverflow.com/questions/56291321/how-to-handle-errors-with-express-listen-in-typescript) which results in above error.

To Reproduce Steps to reproduce the behavior:

  1. Use the template-node-typescript and clone it to your machine.
  2. Install latest version igc
  3. Login to vpc openshift cluster with new toolkit
  4. Run "oc pipeline"
  5. Select Tekton pipeline , master branch, ibm-nodejs and no for pipeline run.
  6. Pipeline will fail at build stage Expected behavior Pipeline should run successfully end-to-end. Screenshots Node-ts_error

Details: igc version- 0.5.10-beta.6 Openshift version: 4.4.17_1515

Additional context Error can be captured by using .on method with app.listen. Fixing the app.listen and adding .on method to capture errors is causing errors in test stage as some of the test cases in server.spec.ts are not getting passed. Can anyone please have a look at my codebase (https://github.com/RamyaRaghuveera/temp-node-ts) and suggest how can we fix the test errors and get the pipeline working end-to-end .

RamyaRaghuveera commented 4 years ago

PR corresponding to the issue: https://github.com/IBM/template-node-typescript/pull/11