Skip to content
This repository was archived by the owner on Sep 26, 2025. It is now read-only.

Conversation

@dbarrosop
Copy link
Member

@dbarrosop dbarrosop commented Sep 22, 2025

PR Type

Enhancement


Description

  • Ensure services become healthy after restart

  • Add GraphQL Yoga dependency and lock updates

  • Introduce example GraphQL Yoga server file

  • Update Nhost metadata with example remote schema


File Walkthrough

Relevant files
Bug fix
up.go
Add health check after service restart                                     

cmd/dev/up.go

  • Logged health verification message
  • Called dc.Start(ctx) to wait for healthy services
+7/-0     
Dependencies
package.json
Add graphql-yoga dependency                                                           

examples/myproject/functions/package.json

  • Added graphql-yoga to dependencies
+1/-0     
pnpm-lock.yaml
Update pnpm lock for GraphQL Yoga                                               

examples/myproject/functions/pnpm-lock.yaml

  • Updated lockfile with graphql-yoga and related packages
  • Added new GraphQL tools and helper dependencies
+250/-0 
Enhancement
remote-schema.ts
Add example remote GraphQL Yoga server                                     

examples/myproject/functions/remote-schema.ts

  • Created GraphQL Yoga server with simple schema
  • Exported yoga handler for /remote-schema
+23/-0   
Configuration changes
remote_schemas.yaml
Add example remote schema metadata                                             

examples/myproject/nhost/metadata/remote_schemas.yaml

  • Added hello-world remote schema entry
  • Configured endpoint and timeout for functions URL
+6/-0     

@github-actions github-actions bot added the fix label Sep 22, 2025
@github-actions
Copy link
Contributor

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
Possible issue
Use docker compose wait

Replace the dc.Start invocation with a docker compose wait command via dc.Wrapper,
which will block until defined healthchecks pass and avoid inadvertently restarting
services.

cmd/dev/up.go [265-267]

-if err := dc.Start(ctx); err != nil {
-    return fmt.Errorf("failed to wait services: %w", err)
+if err := dc.Wrapper(ctx, "wait", "--timeout", "2m"); err != nil {
+    return fmt.Errorf("services did not become healthy: %w", err)
 }
Suggestion importance[1-10]: 8

__

Why: The suggestion replaces dc.Start with dc.Wrapper(ctx, "wait", ...) to leverage Docker Compose’s built-in waiting on healthchecks, avoiding unintended restarts and improving reliability.

Medium
General
Clarify error message wording

Improve the error message by fixing the grammar and specifying that the wait is for
services to become healthy, which makes logs clearer.

cmd/dev/up.go [266]

-return fmt.Errorf("failed to wait services: %w", err)
+return fmt.Errorf("failed to wait for services to become healthy: %w", err)
Suggestion importance[1-10]: 4

__

Why: Specifying for services to become healthy refines the error context, enhancing log clarity with a low-impact change.

Low

@dbarrosop dbarrosop merged commit af7e8c8 into main Sep 22, 2025
8 checks passed
@dbarrosop dbarrosop deleted the wait-for-healthy branch September 22, 2025 08:31
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants