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

CI function do not behave the same as local #390

Open
riderx opened this issue Jun 27, 2024 · 4 comments
Open

CI function do not behave the same as local #390

riderx opened this issue Jun 27, 2024 · 4 comments

Comments

@riderx
Copy link

riderx commented Jun 27, 2024

Describe the bug
All functions test pass 100% of the time in local but often fail in CI/CD env.

*To Reproduce
Steps to reproduce the behavior:
In this repo: https://github.com/Cap-go/capgo
In local, if I do :

  • supabase start
  • npm run minio:start && npm run minio:seed ( I use minio i didn't migrate to s3 api of supabase yet)
  • supabase functions serve
  • deno test --allow-all supabase/functions/tests/* --env=supabase/.env.test --import-map=supabase/functions/import_map.json --fail-fast
  • All test pass.
  • In github action
name: Run tests

on:
  push:
    branches:
      - 'main'

jobs:
  test_base_sql:
    runs-on: ubuntu-latest
    name: "Run test"
    steps:
      - name: "Checkout capgo"
        uses: actions/checkout@v4
      - name: Install Supabase CLI
        uses: supabase/setup-cli@v1
        with:
          version: 1.176.10
      - name: Set env PROD
        run: echo "SUPABASE_DB_PASSWORD=${{ secrets.SUPABASE_DB_PASS }}" >> $GITHUB_ENV    
      - name: 🍜 Prepare Supabase PROD
        run: supabase link --project-ref xvwzpoazmxkqosrdewyv
        env:
          SUPABASE_ACCESS_TOKEN: ${{ secrets.SUPABASE_TOKEN }}
      - name: Run Supabase Start
        run: ENV=local supabase start
      - run: supabase test db
      - uses: denoland/setup-deno@v1
        with:
          deno-version: v1.x
      - name: "Start minio"
        run: npm run minio:start && npm run minio:seed
      - run: deno test --allow-all supabase/functions/tests/* --env=supabase/.env.test --import-map=supabase/functions/import_map.json

Both env run the same way and yet the CI/CD fail, you can see the history of github actions, some endpoint timeout weirdly

Expected behavior
Localhost should fail the same way as CI/CD

@riderx
Copy link
Author

riderx commented Jun 27, 2024

I think i found my issue it was not exactly the same env

@riderx riderx closed this as completed Jun 27, 2024
@riderx riderx reopened this Jul 12, 2024
@riderx
Copy link
Author

riderx commented Jul 12, 2024

I had sadly to re-open it, it still happening.
Example not passing : https://github.com/Cap-go/capgo/actions/runs/9909169516
And passing: https://github.com/Cap-go/capgo/actions/runs/9905586297
No change in the dependency used in edge functions

@sweatybridge
Copy link

Let me move this to functions repo who might have better knowledge of deno testing.

@nyannyacha 502 seems like a server side error from edge runtime. Are there any concurrency caveats with running edge runtime locally?

@sweatybridge sweatybridge transferred this issue from supabase/cli Jul 24, 2024
@nyannyacha
Copy link
Collaborator

I can see from the CI's logs that the status code was 502. However, this doesn't tell us much.

To determine the exact cause, it's a good idea to have the body returned by the edge runtime endpoint also be printed to the log.

Run deno test --allow-all supabase/functions/tests/* --env=supabase/.env.test --import-map=supabase/functions/import_map.json

I'm guessing from the flags given to the deno test that all test files and tests will be run sequentially.

502 seems like a server side error from edge runtime. Are there any concurrency caveats with running edge runtime locally?

I don't think I can advise anything at this point, as this command evaluates all tests sequentially as far as I know, so there's nothing to comment on for concurrency caveats in the edge runtime. 😓

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

3 participants