You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have an angular app and an API that I am developing and I have them both running locally. I am sending a request to my API to upload an image to a storage bucket that I have in my supabase project.
I got this working using my production supabase project. The images upload as expected but the public url for the images did not work on my local angular app (the error was BLOCKED_BY_ORB or something like that). Figured this was due to me trying to access the data on localhost, so decided to try using a local supabase instance using the CLI.
So, I got that all setup and I confirmed that auth + access to the database is working normally, Everything works there, but I cannot upload to the storage bucket anymore. I am getting this error
Invalid URI: The URI scheme is not valid.
I can't find this error related to supabase anywhere. Has anyone seen this before? Any idea how I can get it working? This is the call stack and relevant code:
at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind, UriCreationOptions& creationOptions)
at System.Uri..ctor(String uriString)
at Supabase.Storage.StorageFileApi.UploadOrUpdate(Byte[] data, String supabasePath, FileOptions options, EventHandler`1 onProgress)
at Supabase.Storage.StorageFileApi.Upload(Byte[] data, String supabasePath, FileOptions options, EventHandler`1 onProgress, Boolean inferContentType)
at <MyProjectName>.Services.ImageService.UploadImage(IFormFile file, ImageBucket imageBucket, Guid entityId, ImageType type, Int32 index, String extension) in <FilePath>/Services/ImageService.cs:line 39
public async Task<string?> UploadImage(
IFormFile file,
ImageBucket imageBucket,
Guid entityId,
ImageType type,
int index,
string extension
) {
try {
string path = GenerateFilePath(
imageBucket,
entityId,
type,
index,
extension
);
using var memoryStream = new MemoryStream();
await file.CopyToAsync(memoryStream);
byte[] test = memoryStream.ToArray();
Bucket? bucket = await supabase.Storage.GetBucket(BucketName);
if (bucket is null) {
throw new Exception("Bucket not found");
}
await supabase.Storage.From(bucket.Id!).Remove(path);
string filePath = await supabase.Storage
.From(bucket.Id!)
.Upload(
test,
path,
new FileOptions {
CacheControl = "3600",
Upsert = false
}
);
return supabase.Storage.From(bucket.Id!).GetPublicUrl(filePath);
} catch (Exception e) {
Console.WriteLine(e.Message);
return null;
}
}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I have an angular app and an API that I am developing and I have them both running locally. I am sending a request to my API to upload an image to a storage bucket that I have in my supabase project.
I got this working using my production supabase project. The images upload as expected but the public url for the images did not work on my local angular app (the error was BLOCKED_BY_ORB or something like that). Figured this was due to me trying to access the data on localhost, so decided to try using a local supabase instance using the CLI.
So, I got that all setup and I confirmed that auth + access to the database is working normally, Everything works there, but I cannot upload to the storage bucket anymore. I am getting this error
Invalid URI: The URI scheme is not valid.
I can't find this error related to supabase anywhere. Has anyone seen this before? Any idea how I can get it working? This is the call stack and relevant code:
Beta Was this translation helpful? Give feedback.
All reactions