MaveriX89
Explore posts from serversDTDrizzle Team
•Created by MaveriX89 on 2/16/2025 in #help
Recommended Docker Compose Workflow
Hey all, I'm new to making full stack applications and am working with Drizzle to make mine. I have a question on what the best practice is when using databases that are spun up using Docker Compose and how to initialize them with Drizzle tables.
I have the following
docker-compose.yaml
I am using a code-first approach with Drizzle where I want my codebase to be the source of truth for the database since there is tight coupling between the DB and my API server + SPA. The question I have is, when my app is being spun up for a production deployment, how can I ensure that when my PostgresDB from docker spins up, it also prepped with my Drizzle tables via running drizzle-kit push
when it comes alive?
Essentially, I want to make sure that the definition of my database container being "ready" means, the Postgres container is up, and I pushed my Drizzle tables to it (alongside any optional seed script I decide to run -- I actually have a seed_db.ts
script that I typically invoke locally using bun ./scripts/seed_db.ts
which I would like to run for local dev workflows)2 replies
Component in test is not updating despite signal change
I am currently writing some tests for a library I'm building with Solid. I have the following test:
So the context summary is, I have two primary things under test:
SSOProvider
and the useSSO
hook. As you can see above, I have an internal test component called AuthStateComponent
that is using the useSSO
to either show an authenticated or unauthenticated view. The issue is, when I run my test and trigger a user update, the test component does not re-render to show the authenticated view. It always remains in the unauthenticated despite the fact the user has been updated internally within useSSO
(I verified this via console logging everything).
So that little createEffect log that I have within the test component only ever runs once, outputting a null
, and it does not re-run after the user signal updates internally.
I'm currently stuck in testing this particular area and can't proceed. Not sure exactly what I'm doing wrong here.2 replies
How to filter/remove elements from an array within a Store
If I have the following
createStore
invocation:
What is the proper way to filter/remove an element from that cards
list? I have tried the following and I get yelled at by TypeScript saying it's incorrect.
Since the cards
field is at the top level, is the only option to reference the previous value of the store?
6 replies
Exception thrown when invoking useNavigate within Router root layout
I am having a real hard time working through this problem. I feel like I've tried everything but nothing has been working and there's probably something I'm not seeing clearly anymore.
The short of it is, when I attempt to invoke
navigate("/login")
from my root layout component, I am greeted with the following exception:
Here is the entirety of my App.tsx
file:
The area to focus on is the onClick
for the Sign Out NavbarLink
. In the callback, I am invoking the Better Auth client to sign out and on success, I navigate to /login
. It's that invocation that causes the exception.
I'm not exactly sure the proper way to debug this and could use all the help I can get33 replies
BABetter Auth
•Created by MaveriX89 on 1/21/2025 in #help
Better Auth + Solid Start
When using Better Auth within Solid Start -- after doing all the required configuration, do we simply use the Better Auth server client (instead of the client one) to invoke all auth related matters? So given a Solid Start action like below:
Is the above the expected way we interface with Better Auth on the server? Or is there some other behind the scenes stuff happening due to the below configuration?
Or lastly, should we still be using the Better Auth client on the frontend and do:
3 replies
SolidJS SPA with Better Auth
I am trying to build a SolidJS SPA that uses the new Better Auth library to manage all things related to authentication/authorization for my app. Post all the needed configuration for it, on the SPA side, I have to use the Better Auth client to invoke all the auth related methods on my UI. I have one example here that I'm wrestling with in trying to get a redirect to happen after the user signs in but the redirect is not happening on the Solid SPA side:
My Better Auth Client configuration:
My
SignIn
component:
I'm suspecting that perhaps, the issue has to do with the fact that I am doing the throw redirect
inside of the onSuccess
handler of the Better Auth client as opposed to the scope of the action
itself? Wondering if others have attempted this yet.5 replies
TanStack Query vs Solid Router
I'm looking to use Solidjs for a production app and have a question about a library I typically reach for (TanStack Query) for my SPAs and some of the built-in APIs for Solid Router:
query
+ createAsync
.
Is there any reason to use TanStack when Solid Router comes with those built-in? Just wondering if there is something I'm missing because, the query
+ createAsync
combination if I'm not mistaken provides a lot of the same benefits that TanStack does with request de-deduping and caching by key. Wondering if there are other gaps present that I am not privy to (e.g. easy request refetching/polling on interval or conditional fetching like the enabled
field from TanStack Query).
For the visually inclined -- the question is what is the recommendation between these two options and the pros/cons of each:
Option 1:
VS
Option 2:
P.S. Just throwing it out there but, man, Option 2 look really good haha17 replies
BABetter Auth
•Created by MaveriX89 on 1/21/2025 in #help
Getting UNPROCESSABLE_ENTITY when attempting to sign up a new user
Hitting another issue with Better Auth where I get an error when attempting to do the following:
I receive this error:
I'm wondering if this is because Better Auth does not like the fact that I modified the primary keys of the default Drizzle tables it generated for me to use
uuid
instead of integer
?
Appreciate any and all help with this3 replies
BABetter Auth
•Created by MaveriX89 on 1/21/2025 in #help
Getting INVALID_USERNAME_OR_PASSWORD Error when using correct credentials
I am new to Better Auth and am using the
username()
plugin to enable username/password logins in my ElysiaJS backend. I have the following configurations for both the server and client for Better Auth:
I made some changes to the default Drizzle tables that Better Auth generated in my project:
With the above said, when I am doing local development, I am spinning up a Postgres docker container and run a custom seed script that I have to populate the tables with fake data. I'm probably not doing something correctly there in that step because when I attempt to log in with the fake admin
user I added to the UserTable
, I keep getting INVALID_USERNAME_OR_PASSWORD
back as a response.
Here is a small snippet of what I am doing:
Has anybody else run into this problem when using the username login?1 replies
BABetter Auth
•Created by MaveriX89 on 1/21/2025 in #help
Help in resolving CORS issue with Better Auth
This is my first time using Better Auth and I am pairing it with Elysia and a Solid SPA. The Elysia backend is a dedicated backend-for-frontend that will serve the frontend in production so they will share the same origin url.
I am currently running into CORS issues when I attempt to sign in using the username plug-in. Below are my configurations:
For my frontend SPA, here is my
vite.config.ts
. The thing to note about it is the server.proxy
configuration I have defined. When my frontend makes a request to http://localhost:3000/api/*
it'll route it to port 8000 instead as that is the port where my ElysiaJS backend runs on in a sidecar shell.
My frontend Better Auth client config is the following:
Moving on to the backend side of things, here is my Better Auth server config:
And here is my Elysia setup for Better Auth:
On the frontend, when I attempt to execute authClient.signIn.username(...)
I get the following error:
Clearly, http://localhost:3000
origin is not on that list which is why I'm getting hit with CORS, but I guess I'm wondering the question why since http://localhost:3000/api/auth
is there. And what is the recommended way to resolve this? Hoping to avoid explicit origins..1 replies
Getting UnhandledPromiseRejection in Solid Start server function that stops dev server
I have an
async
function in my Solid Start app and am receiving the following error message whenever it returns an Error
.
Here is the function:
Not sure exactly what's going on and hoping someone can perhaps provide insight.33 replies
DTDrizzle Team
•Created by MaveriX89 on 1/8/2025 in #help
drizzle-kit push not working with pgSchema
Hello, this is my first time using Drizzle and am running into some problems pushing my schema out. I have the following
docker-compose.yaml
that is spinning up a Postgres instance alongside Adminer.
I am using a codebase first approach with Drizzle and have the following schema defined under the following path <project root>/drizzle/schema/auth.ts
And this is my drizzle.config.ts
:
I was able to successfully do drizzle-kit push
and I did this while my databse was running in a container. However, when I open up Adminer to inspect the database, I do not see my auth
schema shown in the UI nor any of the tables I have defined. Hoping someone can assist me here.
Thanks in advance!8 replies
Containerized Solid Start Deployments
I'm new to using Solid Start and full-stack frameworks -- I usually create "vanilla" app architectures (e.g. a Solidjs SPA paired with an Elysia backend-for-frontend layer). With those vanilla setups, I could containerize the deployments using Dockerfiles and reason about them very easily. However, for Solid Start, I'm not sure how to reason about them fully because there are gaps in my knowledge.
The intent I have is to create a containerized Solid Start deployment that I could run anywhere (Azure, AWS, GCP, etc.). In my app, I am using a database (SQLite + Drizzle ORM) and Better Auth for authentication/authorization (it adds tables to the database mentioned earlier). I would also like to use Bun for my runtime -- unsure if this is a wise-decision if Bun isn't supported fully across hosting providers.
I had the following
Dockerfile
but unfortunately it does not work as the docker build
chokes when attempting to install the better-sqlite3
dependency I have in my project:
I suspect it has something to do with the base Bun image I'm using, but I went and used the full oven/bun
base image and that still did not resolve the install block on better-sqlite3
. Hoping someone with more experience in this arena can assist or guide my thinking so that I can better understand how to work through these kinds of problems.
Thanks for any help in advance!
P.S. I feel like this is a great opportunity to perhaps update the Solid Start documentation to include a section on Deployments and what that looks like if people want to pursue the whole "build once and deploy anywhere" mantra. That may be a pipe dream because I'm sure there are a lot of fancy things going on under the hood that may make that hard to generalize, but just a thought that I had and wanted to share here. 🙂2 replies
Vite 5.2.x / Vitest 1.5.x: How to Resolve Multiple Instances of Solid
I am nearing my wits end trying to resolve these error messages I receive when trying to run my SolidJS tests with
@solidjs/testing-library
and vitest
I do not know what else to try and need assistance if anyone can help. I have the following vite.config.ts
In my package.json
these are the dependencies I have:
6 replies
How to handle necessary async/await work inside of a createEffect?
I'm building a SolidJS hook library and I have some asynchronous work that needs to happen which is occurring in a
createEffect
. I'm currently trying to write integration tests against my hook library and running into problems because I'm currently not awaiting the Promise result which is conflicting with other things occurirng in test. The way I work around it for testing purposes is literally doing an await sleep(1000)
in test to wait for that asynchronous work to finish.
Is there a better way to write my createEffect
in such a way where I do not have to do a sleep
in test?
8 replies
Getting ReferenceError: React is not defined with Vitest + Solid Testing Library
I honestly have no idea how I am receiving this error but I am despite testing using
@solidjs/testing-library
. Moreover, I am using Vitest
by itself (not Vite
) and my vitest.config.ts
is as follows:
The test that is causing the error to appear is a custom Solid hook test where I am attempting to pass a wrapper
to my renderHook
invocation.
Anybody seen that before?26 replies
Creating custom SolidJS hook that can be used in a global scope
Need some help understanding how to build a custom SolidJS hook that can be used both locally inside a component and outside in the global scope (like
createSignal
can).
Below is. a small snippet of a custom hook I am writing:
The question I have is around the floating createMemo
that I use in the implementation. When I use the createDatabase
hook globally, I get greeted with the console warning:
computations created outside a 'createRoot' or 'render' will never be disposed
I'm not familiar with how to properly address that warning and hoping the community can offer some guidance here.17 replies
Need clarity on eslint(solid/reactivity) warning use-case
I need help understanding how to deal with this ESLint warning when I am building a custom SolidJS hook library that doesn't have any visual components.
There is a portion of my custom hook code that gets called out by this warning and I don't know how I should properly resolve it (or if it is safe to ignore it).
The code snippet where I receive the warning is the following:
What is the proper way to address the warning in this case? Or is this something I can safely ignore perhaps?
5 replies