This app was running very fine in docker, however, I moved it from public subnet to private subnet and all hell was let loose. I get the following error message:
[Nest] 19 - 07/04/2022, 12:27:26 PM LOG [InstanceLoader] TypeOrmModule dependencies initialized +0ms
[Nest] 19 - 07/04/2022, 12:27:26 PM LOG [InstanceLoader] TypeOrmModule dependencies initialized +0ms
[Nest] 19 - 07/04/2022, 12:27:26 PM LOG [InstanceLoader] TypeOrmModule dependencies initialized +1ms
[Nest] 19 - 07/04/2022, 12:27:26 PM ERROR [ExceptionHandler] No repository for "ProvidersRepository" was found. Looks like this entity is not registered in current "default" connection?
RepositoryNotFoundError: No repository for "ProvidersRepository" was found. Looks like this entity is not registered in current "default" connection?
at RepositoryNotFoundError.TypeORMError [as constructor] (/app/node_modules/typeorm/error/TypeORMError.js:9:28)
at new RepositoryNotFoundError (/app/node_modules/typeorm/error/RepositoryNotFoundError.js:13:28)
at EntityManager.getRepository (/app/node_modules/typeorm/entity-manager/EntityManager.js:677:19)
at Connection.getRepository (/app/node_modules/typeorm/connection/Connection.js:379:29)
at InstanceWrapper.useFactory [as metatype] (/app/node_modules/@nestjs/typeorm/dist/typeorm.providers.js:12:30)
at Injector.instantiateClass (/app/node_modules/@nestjs/core/injector/injector.js:333:55)
at callback (/app/node_modules/@nestjs/core/injector/injector.js:48:41)
at async Injector.resolveConstructorParams (/app/node_modules/@nestjs/core/injector/injector.js:122:24)
at async Injector.loadInstance (/app/node_modules/@nestjs/core/injector/injector.js:52:9)
at async Injector.loadProvider (/app/node_modules/@nestjs/core/injector/injector.js:74:9)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! payment-service@0.0.1 start:prod: `node dist/main`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the payment-service@0.0.1 start:prod 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! /root/.npm/_logs/2022-07-04T12_27_26_603Z-debug.log
The funny thing is that if I change the dockerfile and build it, it will run locally, but once I run it using github action, it will start failing, also locally.
This is my dockerfile:
WORKDIR /app
COPY ./package.json ./
RUN npm install
COPY . .
COPY .env ./.env
RUN npm run build
#FROM node:10-alpine
#WORKDIR /app
#COPY --from=builder /app ./
#COPY src /app/
CMD ["npm", "run", "start:prod"]```
I can't seem to figure out the issue