Supabase storage bucket #5334
Replies: 6 comments 3 replies
-
Are you looking to use supabase as your db? For that all you need to do is follow the If you're looking for cloud storage for uploads, that was something we had a PR for, but I'm struggling to find now. |
Beta Was this translation helpful? Give feedback.
-
Also looking to use Supabase storage with Payload. It should theoretically be straightforward to use the S3 adapter now that Supabase is S3-compatible, but I'm having issues. Here is my adapter configuration: const supabaseStorageAdapter = s3Adapter({
bucket: process.env.S3_BUCKET,
config: {
endpoint: process.env.S3_ENDPOINT,
credentials: {
accessKeyId: process.env.S3_ACCESS_KEY_ID,
secretAccessKey: process.env.S3_SECRET_ACCESS_KEY,
},
region: process.env.S3_REGION,
},
}); I get
I suspect it has something to do with the |
Beta Was this translation helpful? Give feedback.
-
Any updates on this? @DanRibbens @denolfe Supabase Storage support in Payload has been marked as planned in January (#4936). Supabase Storage is officially S3 compatible since April, so it should hopefully not require a huge deal of additional work to get it working using existing S3 adapters. It would be great to get this working. I'd like to start using Payload, but the lack of Supabase storage support was a deal-breaker on two projects for me in the past month. I'm sure many folks who are striving to use a modern frontend stack would also appreciate it. |
Beta Was this translation helpful? Give feedback.
-
I spent more time than I can recall, at least roughly 18 hours, on getting Payload CMS to work with Supabase storage since the Supabase with Payload YouTube video was released. That being said, I’ve finally got it working with beta.52 – hallelujah! I will post an extensive article detailing my configuration hopefully soon. In the meantime, you can check out my foliomark4 public repo on GitHub. You should be able to pull it and theoretically get it working, although it’s missing environment variables which should be deducible from the code. It works on my machine, just have to figure out how to get it to work on Vercel now. I love Payload CMS! Edit 2406241826: I'm leaving my previous edit intact. I ended up having to scrap using Supabase's S3. The S3 adapter is configured to automatically prepend the bucket name to the beginning of the endpoint url. There's no way around this apparently. I thought I got it working in Payload 3.0 with the new storage adapter but I've downloaded and configured and played with the E-Commerce template and gotten cloud storage working with that and I had to go to https://cloud.linode.com/object-storage/ and configure a new bucket. Now I've got to go back and see if this works with my Payload CMS 3.0 project. In the meantime I'm working through the JSM Youtube video Build and Deploy a Full Stack E-Commerce App with an Admin Dashboard & CMS in 2024 | Next 14, Stripe
Edit 2406241826: I've spent the whole day troubleshooting this. I got it working on my machine, but when I tried to replicate it on another machine, the site loaded without any images. Then, I went back to my original machine, and now all the images are returning 500 errors. I think the long and the short of it is that you must use the storage-s3 adapter with Payload CMS 3.0 beta. Like I said, for a very brief moment, I got it running with beta .53... :(. Here’s a detailed breakdown of what I’ve tried and the current setup: Environment Variables
Issues Encountered In any event, you can see my config in the repo, I've just updated it: https://github.com/kendevco/foliomark4 API Key Issue: I got an API Key error initially when the wrong endpoint url was set. The error message indicating "No API key found in request" resolved once endpoint set correctly in s3 test client. Right now, separate settings have enabled images to load. I can't figure out how to set a breakpoint in a package (yet) otherwise I'd've figured out what the issue was. It would be really great to have new videos on the Payload YouTube Channel covering: Setting Up a Payload 3.0 Development Environment: A comprehensive guide similar to setting up a DNN environment (https://youtu.be/zLB6uzdqGF8?si=Oh9s87Bs0xLh4aYn). Test Client which did work:
Perhaps if you've read this far, you might know of good resources for learning how to set up a Payload CMS 3.0 development environment? Additionally, a good tutorial on debugging Payload CMS packages/plugins would be really helpful. I see Payload CMS as the DotNetNuke of Next.js – which it pretty much is. I started with DNN at version 2.1.2 back in 2003/4, and I believe Payload CMS is even cooler. It's way better in many ways but could still take some pointers from DNN. I've committed to using Payload CMS for all of my Next.js projects moving forward. It is quite frustrating because I have been so eagerly anticipating the release of Payload CMS 3.0. It is so awesome in beta but very frustrating with this whole cloud storage thing. I spent about 16 hours or so integrating it into my static portfolio site converting all the controls into 'client' and 'server' controls. I had everything all nice and upgraded and running great on my machine. Then I was even able to deploy it to Vercel and it ran. However, I didn't realize the default media adapter which saves files to the local server doesn't work when deployed to Vercel. Back to the drawing board. So now, I've essentially recreated my portfolio site - my test bed, so to speak - four times. This fourth time, I actually got it to work after probably another 40 or so hours battling and learning how the storage adapter works. Or not. Pretty much at 0 on figuring out how to step through a package/plugin. One significant improvement would be to have a default site dynamically generated from a default page collection, enabling users to use the block-based content builder, as referenced in the Payload CMS documentation. This would allow users to create and manage their site's structure more intuitively right from the start. The site could still be conventionally updated with other routes in the app folder, but this default setup would provide a robust dynamic site out of the box. This concept is somewhat addressed by the current corporate website demo app, although it hasn't been updated to Payload 3.0 yet. The corporate website template demonstrates many capabilities and serves as a good starting point. Additionally, the updated eCommerce starter template, which I am looking forward to exploring, will likely cover the remaining use cases. Would be great to have a guide on how to contribute to these as well. On YouTube preferably :). Go JavaScript Mastery JSM who introduced me to Payload CMS with their excellent YouTube course on modifying the Payload ECommerce Template. I've been waiting since then for Payload CMS 3.0. |
Beta Was this translation helpful? Give feedback.
-
Hi I ran into the same pesky issue, but I found a nifty solution! Here's my settings for Supabase Storage: s3Storage({
collections: {
media: true,
},
bucket: process.env.S3_BUCKET,
config: {
credentials: {
accessKeyId: process.env.S3_ACCESS_KEY_ID,
secretAccessKey: process.env.S3_SECRET_ACCESS_KEY,
},
region: process.env.S3_REGION,
endpoint: process.env.S3_ENDPOINT,
forcePathStyle: true
},
}), Give it a whirl and see if it solves the problem for you too. |
Beta Was this translation helpful? Give feedback.
-
For me it worked by adding this to the config:
|
Beta Was this translation helpful? Give feedback.
-
I was wondering how can i implement the supabase adapter in this plugin.
#4983
Beta Was this translation helpful? Give feedback.
All reactions