#Example repo using graphql/apollo v12 that works on a docker container

4 messages · Page 1 of 1 (latest)

warped gale
#

Hi, does anyone have a working example of a @foggy wing/[apollo|graphql] v12 repo that successfully runs on a docker container?

I am working on an app using these dependencies and it runs locally, but when I try to build in a container it hangs after initializing the GraphQLModule depdencies, and then dies with an OOM error.

When searching online it seems most examples are not using the latest versions.

Local logs:

...
[Nest] 13612  - 11/09/2023, 11:55:39 AM     LOG [InstanceLoader] GraphQLSchemaBuilderModule dependencies initialized +1ms
[Nest] 13612  - 11/09/2023, 11:55:39 AM     LOG [InstanceLoader] GraphQLModule dependencies initialized +0ms
[Nest] 13612  - 11/09/2023, 11:55:39 AM     LOG [GraphQLModule] Mapped {/graphql, POST} route +87ms
[Nest] 13612  - 11/09/2023, 11:55:39 AM     LOG [NestApplication] Nest application successfully started +1ms

versus container logs:

...
[Nest] 1  - 11/09/2023, 8:13:18 PM     LOG [InstanceLoader] GraphQLSchemaBuilderModule dependencies initialized +1ms
[Nest] 1  - 11/09/2023, 8:13:18 PM     LOG [InstanceLoader] GraphQLModule dependencies initialized +0ms

<--- Last few GCs --->

[1:0xffffa5df23c0]    79195 ms: Mark-sweep 964.9 (1003.8) -> 958.5 (1004.3) MB, 642.2 / 0.0 ms  (average mu = 0.229, current mu = 0.094) task scavenge might not succeed
[1:0xffffa5df23c0]    79926 ms: Mark-sweep 965.5 (1004.3) -> 959.1 (1005.0) MB, 632.5 / 0.0 ms  (average mu = 0.184, current mu = 0.135) task scavenge might not succeed
[1:0xffffa5df23c0]    80653 ms: Mark-sweep 966.3 (1005.0) -> 959.7 (1005.8) MB, 661.0 / 0.0 ms  (average mu = 0.139, current mu = 0.090) task scavenge might not succeed


<--- JS stacktrace --->

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
magic raft
#

Usually this is due to inefficient circular dependencies or classes that nest is having to decorate and create the schemas for. You should be able to increase the memory size if the docker containers and get things working

warped gale
#

Thank you for your response. I don't believe this is the issue in this case as it starts immediately locally. I increased the memory size on the container but it just delayed the OOM error, and the app still failed to start up.

I have also reduced my app to match https://github.com/nestjs/nest/tree/master/sample/32-graphql-federation-schema-first/users-application exactly - the same code and the same dependencies. Again works locally but dies in the container. I will keep digging.

[Nest] 1  - 11/09/2023, 9:01:52 PM     LOG [InstanceLoader] GraphQLSchemaBuilderModule dependencies initialized +0ms
[Nest] 1  - 11/09/2023, 9:01:52 PM     LOG [InstanceLoader] GraphQLModule dependencies initialized +0ms

<--- Last few GCs --->

[1:0xffffbbafa3c0]   126637 ms: Mark-sweep 1919.8 (2080.5) -> 1909.0 (2079.3) MB, 1302.0 / 0.0 ms  (average mu = 0.096, current mu = 0.026) task scavenge might not succeed
[1:0xffffbbafa3c0]   126666 ms: Scavenge 1922.1 (2079.5) -> 1911.5 (2079.5) MB, 5.1 / 0.0 ms  (average mu = 0.096, current mu = 0.026) task 
[1:0xffffbbafa3c0]   126725 ms: Scavenge 1922.1 (2079.5) -> 1912.9 (2081.0) MB, 9.9 / 0.0 ms  (average mu = 0.096, current mu = 0.026) task 


<--- JS stacktrace --->

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory

GitHub

A progressive Node.js framework for building efficient, scalable, and enterprise-grade server-side applications with TypeScript/JavaScript 🚀 - nestjs/nest

magic raft
#

You local machine has more memory than the docker container does. I wouldn't put it past that.

If you can provide a minimum reproduction I'll take a look