-
-
Notifications
You must be signed in to change notification settings - Fork 7.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NestJS fails silently on multi package repo. #2702
Comments
Hi @kamilmysliwiec, I am trying to deploy my app on aws lambdas (it works fine on my local environment, where everything is configured ok), and struggling to understand the problems that arise from the different environment because of the silent failures. I know you dealt with similar issues in the past, can you give me some hints on how to debug the errors? In addition to what I posted on the original issue, I also tried putting console.log() lines inside typeorm and tslib just to know what is going on, but I am a bit lost on where the error is happening. I spent the best part of 2 days trying to find the source of the problem already, and I haven't been able to get a good idea of what is failing. Thanks for your patience, |
+1, I'm having a similar issue. I've lost quite some time figuring out where the issue was. On a side note, I've tried to use a |
I had the similar issue. When I looked at my
after removed these two lines, my app works properly. |
try |
Hi guys, thanks for the answers. @loftyet, I tried removing esModuleInterop (incremental was not set), and after getting the code to compile again, the problem still fails silently... @sudogeek I tried adding that import, or getting the library with the require() syntax, but did not seem to make a difference... I tested both things by removing an entity from the typeorm definitions of the module I am using, and it still failed silently... I get the impresion this is a bug on nestjs... |
Sorry for taking so long to get back to you, I'm spread pretty thin right now, and that my suggestion wasn't helpful. I found this issue searching for clues to a completely unrelated error, but I'm going to clone your repo and see if I can reproduce it at home and go from there. I'll let you know what I find out. |
It failed silently because you are using a custom logger and |
Thanks @sunnylqm! I just checked and assigning the logger on creation time fixes the issue for me:
Just a question, I checked my code and I haven't been able to find the point where the custom logger is set... How did you realise that the problem was the logger? What is the default behaviour for the logger? |
@sudoJoe |
I too had this issue. The NestJS documentation advises to add the following to the factory method: const app = await NestFactory.create(ApplicationModule, {
logger: false,
}); As mentioned above, if the Logger configuration fails, it will fail silently. I switched this configuration to have |
We don't advise to disable logging.
It's information, not a recommendation. |
Bug Report
Current behavior
When creating my application module with NestFactory.createApplicationContext(), if something goes wrong (i.e. we forgot to include a mandatory provider for the module) Nest fails silently, without throwing an exception or showing an error message, which makes it hard to debug.
I checked #287, #1959, and #2377 that were similar but didn't seem to solve the issue.
Input Code
I tried reproducing the issue using the samples, but in that case it seemed to be working OK.
I wasn't sure if my mono repo configuration was to blame for the issue so, I butchered my repo a bit to show the error.
Please check: https://github.com/alexmantaut/nets-js-silent-fail-issue
To debug run: ./packages/sls-random/src/index.ts
Also, I attached vscode debug configuration.
The important part:
When I debug I only get the start message and then my application ends. Using vscode I can see that there is an exception, but then the program stops.
Exception:
Expected behavior
I would expect to get either an exception or an error message.
Possible Solution
Having NestFactory.createApplicationContext() throw an exception would be ideal for me, but any sort of error reporting would be useful in this case.
Environment
Nest version: 6.5.3
For Tooling issues:
The text was updated successfully, but these errors were encountered: