Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

servcices/supabase: Tracking issues of not fixed issues at storage-api side #2199

Closed
1 of 3 tasks
Xuanwo opened this issue May 2, 2023 · 11 comments
Closed
1 of 3 tasks
Labels
good first issue Good for newcomers help wanted Extra attention is needed services/supabase

Comments

@Xuanwo
Copy link
Member

Xuanwo commented May 2, 2023

Visit #2190 for more context.

This issue has been converted as a tracking issue of not fixed issues at storage-api side:

We are keeping this issue to ensure that we have a valid context for contacting the Supabase development team.

@xyjixyjixyji
Copy link
Contributor

Please assign this to me, it is almost done xD

@xyjixyjixyji
Copy link
Contributor

Also, I found that many tests require read_with_range capabilities, but the Supabase seems do not support the http RANGE header.

Is it reasonable to add

    if !op.info().capability().read_with_range {
        return Ok(());
    }

to tests that call into the op.range_reader()?

@Xuanwo
Copy link
Member Author

Xuanwo commented May 3, 2023

Also, I found that many tests require read_with_range capabilities, but the Supabase seems do not support the http RANGE header.

Supabase seems handled range header already:

https://github.com/supabase/storage-api/blob/1794d04ab0e7259d9058293e257f442015252ec3/src/storage/renderer/asset.ts#L14-L20

  getAsset(request: FastifyRequest, options: RenderOptions) {
    return this.backend.getObject(options.bucket, options.key, options.version, {
      ifModifiedSince: request.headers['if-modified-since'],
      ifNoneMatch: request.headers['if-none-match'],
      range: request.headers.range,
    })
  }

@Xuanwo
Copy link
Member Author

Xuanwo commented May 3, 2023

Supabase has two different storage backend, s3 supports range, but file not. It's another issue from supabase storage side 🤣

  async getObject(
    bucketName: string,
    key: string,
    version: string | undefined
  ): Promise<ObjectResponse> {
    const file = path.resolve(this.filePath, withOptionalVersion(`${bucketName}/${key}`, version))
    const body = fs.createReadStream(file)
    const data = await fs.stat(file)
    const { cacheControl, contentType } = await this.getFileMetadata(file)
    const lastModified = new Date(0)
    lastModified.setUTCMilliseconds(data.mtimeMs)

    const checksum = await fileChecksum(file)

    return {
      metadata: {
        cacheControl: cacheControl || 'no-cache',
        mimetype: contentType || 'application/octet-stream',
        lastModified: lastModified,
        // contentRange: data.ContentRange, @todo: support range requests
        httpStatusCode: 200,
        size: data.size,
        eTag: checksum,
        contentLength: data.size,
      },
      body,
    }
  }

@Xuanwo
Copy link
Member Author

Xuanwo commented May 3, 2023

Also, I found that many tests require read_with_range capabilities, but the Supabase seems do not support the http RANGE header.

Is it reasonable to add

    if !op.info().capability().read_with_range {
        return Ok(());
    }

to tests that call into the op.range_reader()?

Yes, we should ignore tests for services that doesn't support range. Please make sure all services have this capability been set correctly.

@xyjixyjixyji
Copy link
Contributor

Of course. I will patch that alongside my Supabase CI fix.

@xyjixyjixyji
Copy link
Contributor

Supabase has two different storage backend, s3 supports range, but file not. It's another issue from supabase storage side 🤣

  async getObject(
    bucketName: string,
    key: string,
    version: string | undefined
  ): Promise<ObjectResponse> {
    const file = path.resolve(this.filePath, withOptionalVersion(`${bucketName}/${key}`, version))
    const body = fs.createReadStream(file)
    const data = await fs.stat(file)
    const { cacheControl, contentType } = await this.getFileMetadata(file)
    const lastModified = new Date(0)
    lastModified.setUTCMilliseconds(data.mtimeMs)

    const checksum = await fileChecksum(file)

    return {
      metadata: {
        cacheControl: cacheControl || 'no-cache',
        mimetype: contentType || 'application/octet-stream',
        lastModified: lastModified,
        // contentRange: data.ContentRange, @todo: support range requests
        httpStatusCode: 200,
        size: data.size,
        eTag: checksum,
        contentLength: data.size,
      },
      body,
    }
  }

What do you think, should we raise an issue there? 🤣

@Xuanwo
Copy link
Member Author

Xuanwo commented May 3, 2023

What do you think, should we raise an issue there?

Yes, please raise an issue to supbase storage-api and link here. We can add read_with_range for supabase when they addressed it.

@Xuanwo

This comment was marked as resolved.

@Xuanwo Xuanwo changed the title servcices/supabase: Tracking issues of not passed test cases servcices/supabase: Tracking issues of not fixed issues at storage-api side May 4, 2023
@Xuanwo
Copy link
Member Author

Xuanwo commented May 4, 2023

Thanks to @Ji-Xinyou, most work at opendal side is done!

@Xuanwo
Copy link
Member Author

Xuanwo commented Jun 6, 2024

We are going to remove supabase support, let's close.

@Xuanwo Xuanwo closed this as not planned Won't fix, can't repro, duplicate, stale Jun 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed services/supabase
Projects
None yet
Development

No branches or pull requests

2 participants