Skip to content
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

Running unit tests in Github Action fails with error `name resolution failed #3333

Open
zeluspudding opened this issue Mar 21, 2025 · 1 comment

Comments

@zeluspudding
Copy link

My goal is to create a github workflow that only deploys updates to Supabase functions after passing unit tests (after a commit to main branch). I've tried many iterations of the official, recommended github workflow including adding additional pauses to let things finish setting up. Here's one iteration of Github workflow I've tried:

name: Deploy Supabase Edge Functions

on:
  push:
    branches:
      - main
  workflow_dispatch:

jobs:
  test:
    runs-on: ubuntu-latest
    environment: main
    
    env:
      # list of keys...
    
    steps:
      - uses: actions/checkout@v3
      - uses: supabase/setup-cli@v1
        with:
          version: latest
      - uses: denoland/setup-deno@v2
        with:
          deno-version: latest
      - name: Start Supabase and wait for it to be ready
        run: |
          supabase start &
          echo "Waiting for Supabase to be ready..."
          timeout 240 bash -c 'until curl -s http://localhost:54321/functions/v1/ok > /dev/null; do sleep 5; done; sleep 30'
          echo "Supabase is ready!"
      - name: Run Tests
        run: |
          cd supabase/functions
          deno test --allow-all

I've also tried versions of this script, but about 2.5 minutes into running, my Github action consistently fails with the following error snippet:

Check file:///home/runner/work/supabase-functions/supabase-functions/supabase/functions/tests/send-email.test.ts
Check file:///home/runner/work/supabase-functions/supabase-functions/supabase/functions/tests/sendgrid-webhook.test.ts
running 16 tests from ./tests/send-email.test.ts
Email schema validation with all fields ...
------- output -------
data { message: "name resolution failed" }
----- output end -----
Email schema validation with all fields ... FAILED (10ms)
Email schema validation with only required fields ... FAILED (2ms)
Reject empty email string ... FAILED (2ms)
Convert complex BBCode to HTML ... FAILED (1ms)
Send an email to multiple recipients ... ignored (0ms)
Send email with Disable Sendgrid unsubscribe link ... ignored (0ms)
Send Email with multiple file attachments ... ignored (0ms)
Email with attachments provided as string instead of array ... FAILED (2ms)
Handles null values for all optional fields ... ignored (0ms)
Handles null values for logo_url ... FAILED (2ms)
Handle logo_url missing protocol ... FAILED (2ms)
Handles null values in attachments array ... FAILED (1ms)
Handles all null attachments by removing attachments field ... FAILED (2ms)
Handles null values in attachments array provided as string ... FAILED (2ms)
Handles all null attachments provided as string by removing attachments field ... FAILED (1ms)
TEMPLATE ... ignored (0ms)
running 13 tests from ./tests/sendgrid-webhook.test.ts
Return 200 if bubble_url or bubble_message_id missing ... FAILED (8ms)
Validate composite open events ... FAILED (2ms)
Validate composite click events ... FAILED (3ms)
Validate composite click and openevents ... FAILED (3ms)
Validate composite click events with out of order events ... FAILED (2ms)
Validate composite click and open events with out of order events ... FAILED (2ms)
Validate multiple events ... FAILED (2ms)
Succesfully stop if bubble_url not in subappConfig ... FAILED (3ms)
Update click_count of bubble message in Mothership ... ignored (0ms)
Update click_count and open_count of bubble message in Mothership ... ignored (0ms)
Update status of bubble message in Mothership for non-engagement events ... ignored (0ms)
Log failure when bubble_message_id invalid ... ignored (0ms)
Update status of bubble message in Mothership for non-engagement events ... ignored (0ms)

 ERRORS 

Email schema validation with all fields => ./tests/send-email.test.ts:36:6
error: AssertionError: Values are not equal.


    [Diff] Actual / Expected


-   [503](https://github.com/statstaklabs/supabase-functions/actions/runs/13980526165/job/39144585342#step:6:504)
+   200

  throw new AssertionError(message);
        ^
    at assertEquals (https://deno.land/[email protected]/assert/assert_equals.ts:53:9)
    at file:///home/runner/work/supabase-functions/supabase-functions/supabase/functions/tests/send-email.test.ts:65:3

Email schema validation with only required fields => ./tests/send-email.test.ts:96:6
error: AssertionError: Values are not equal.

Full log available here. I suspected from another GH issue (I lost the link) that I needed to enable auth in my config.toml. I did that, as shown below:

project_id = "supabase-functions"

[api]
port = 54321

[db]
port = 54322

[studio]
port = 54323

[auth]
enabled = true

But that did not fix the error :(

This project issue I could find with a name resolution failed error code suggested to start and stop and start the supabase containers again, which doesn't seem applicable since my containers are fresh on every Github workflow run. The only other project issue I could find with a name resolution failed error code was closed without solution.

Any help/guidance on this would be very appreciated!

@zeluspudding
Copy link
Author

zeluspudding commented Mar 26, 2025

Was this the right repo to post this issue in? Or should I post in /supabase/supabase?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant