supabase-cache-helpers
supabase-cache-helpers copied to clipboard
Tips for building and contributing to the project
Hello!
I just started using this package and I'm wanting to dive deeper into how this is working and potentially contribute after learning more. Do you have any advice for building, running, and testing the project? I downloaded it and ran pnpm i with pnpm 9 and that went rather smoothly. Then I started the supabase instance and ran the tests in the projects. There were lots of failing tests so I wasn't sure if that was expected or I was still missing configuration.
I'm specifically getting this error when running tests:
Error: Failed to resolve entry for package "@supabase-cache-helpers/postgrest-core". The package may have incorrect main/module/exports specified in its package.json.
hey @colespencer1453, thanks for your interest in contributing to this library. Highly appreciated!
we are using pnpm v8 still, although despite the updated lockfile I dont think there will be any problems when using v9 instead.
The test require the dependencies to be built. I just added the missing task definition to turbo for this (https://github.com/psteinroe/supabase-cache-helpers/commit/2349efd40885b8366d96094f98a202f3c2fa4345). if you run the test without turbo, you need to run the build manually. I usually just run pnpm -w run build:packages. Note that if you do any update to a dependency (e.g. postgrest-core when you want to run postgrest-swr tests), you have to rebuild that package for the changes to take effect. Further, some integration tests require supabase to run. So it's always a good idea to run pnpm supabase start before working on the project.
Let me know if you encounter any further issues or if something else is unclear. I would also appreciate a contributors guide!
hey @colespencer1453, thanks for your interest in contributing to this library. Highly appreciated!
we are using pnpm v8 still, although despite the updated lockfile I dont think there will be any problems when using v9 instead.
The test require the dependencies to be built. I just added the missing task definition to turbo for this (2349efd). if you run the test without turbo, you need to run the build manually. I usually just run
pnpm -w run build:packages. Note that if you do any update to a dependency (e.g.postgrest-corewhen you want to runpostgrest-swrtests), you have to rebuild that package for the changes to take effect. Further, some integration tests require supabase to run. So it's always a good idea to runpnpm supabase startbefore working on the project.Let me know if you encounter any further issues or if something else is unclear. I would also appreciate a contributors guide!
@psteinroe I think I'm making progress, but still struggling to run the tests specifically for postgrest-react-query. If I cd to the folder for it and run pnpm test all of the tests fail. If I run pnpm test from the root then it runs tests for @supabase-cache-helpers/storage-core:test: and all of them are passing. I'm not familiar with turbo so I'm probably missing something here. I have the supabase db up and running without issue.
UPDATE: The specific error that I'm getting when running these tests is "The schema must be one of the following: ". Currently debugging.
@psteinroe looks like the main issue here was the supabase config.toml file had an empty array for schemas exposed in the api. Is this intentional?
[api]
# Port to use for the API URL.
port = 54321
# Schemas to expose in your API. Tables, views and stored procedures in this schema will get API
# endpoints. public and storage are always included.
schemas = []
# Extra schemas to add to the search_path of every request.
extra_search_path = ["extensions"]
# The maximum number of rows returns from a view, table, or stored procedure. Limits payload size
# for accidental or malicious requests.
max_rows = 1000
it is, public and storage are always exposed. What errors do you get?
I get "The schema must be one of the following :" with a blank list. When adding "public" to the array of schemas this error is resolved and most of the tests are passing.
that is indeed weird! Are you using the supabase cli version declared in the repo?
All I see in the repo is "supabase":"latest" in the package.json. I upgraded my cli to latest and I"m still getting the same thing.
supabase cli version: "1.219.2"
Looks like I just had a bunch of older supabase docker images cached that needed to get cleared. All is well now. Also wasn't using pnpm supabase so was using latest cli version. Version in the project appears to be 1.183.5.