RemixSite - common packages broken with esbuild - can't use Postgres at all
I have been running into problems that make the RemixSite unusable when attempting to deploy. When trying to use prisma I am running into a bunch of issues where the schema.prisma file cannot be found. I manually downloaded the lambda bundle, added in the schema.prisma file and re-uploaded the zip. This solved the issue of a missing schema.prisma file, but prisma will timeout for any attempt to make a db request:
- see these prisma errors):
- https://github.com/prisma/prisma/issues/17630
Additionally, when trying to use another package node-postgres AKA pg, I ran into an issue where the package pg-native cannot be found. After doing some digging this appears to be an issue where esbuild cannot package pg-native, somehow the Remix build process will run successfully but the SST RemixSite cannot bundle this successfully. This appears to be some sort of issue due to the single file output maybe?
- https://github.com/brianc/node-postgres/issues/2800
I have successfully build my site with Prisma and with node-postgres and ran queries in development mode. This mode only uses the esbuild output that Remix provides and not the esbuild output from SST's RemixSite. This is an issue that effectively prevents someone from using Postgres at all in their SST remix app as any of the drivers to connect to postgres cannot be bundled in their app. It would seem that most (all?) of the other postgres clients such as sequalize, typeOrm, etc use pg as a dependency too so I would assume there is not much luck with those options either.