Tigris - presignedUrl not working

Hi I’m trying to use Tigris pre-signed url in SvelteKit and I’m finding it is not working.

I have created a new bucket in Tigris, that is private (default) using AWS s3 packages in SvelteKit to do this query:

const pfp = await getSignedUrl(
        TigrisDB, //my client
        new GetObjectCommand({ Bucket: BUCKET_NAME, Key: event.locals.profile?.image || undefined }),
        { expiresIn: 300 } // 30 seconds
    )

My TigrisDB is initialized as:

export const TigrisDB = new S3Client({
    region: AWS_REGION,
    endpoint: AWS_ENDPOINT_URL_S3,
    credentials: {
        accessKeyId: AWS_ACCESS_KEY_ID,
        secretAccessKey: AWS_SECRET_ACCESS_KEY,
    },
});

where the envs are:

AWS_ENDPOINT_URL_S3 = https://fly.storage.tigris.dev
AWS_REGION = auto

Is this correct?

@ovaistariq would greatly appreciate your help. Do I need to do anything additional on the Tigris dashboard??

Hey @hgoona, the env variables are correct. What’s the error you are seeing?

@ovaistariq I’m seeing this in SvelteKit terminal:
SvelteKitError: Not found: /user/uploads/828d98f1-4e57-492f-a3a1-8770fb1c457c-20241027_174544_socrates_ideas.jpg

However, when logging the pfp var i see:
pfp: 'https://**<my app's name>**.fly.storage.tigris.dev/uploads/828d98f1-4e57-492f-a3a1-8770fb1c457c-20241027_174544_socrates_ideas.jpg?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=tid_uOVpucLjyeVozWhlqlXRGAquoAnoJdxhPsvfOaCNbicxmeXgPk%2F20241203%2Fauto%2Fs3%2Faws4_request&X-Amz-Date=20241203T060143Z&X-Amz-Expires=300&X-Amz-Signature=24ea6291034e4817125e16ba235a58e57b6e3c06f39b796b95b6ef4452b4b29c&X-Amz-SignedHeaders=host&x-id=GetObject'

Is this correct? Do i need to configure anything in the Tigris Dashboard??

OKAY! I think I’ve found my issue - I had a stupid error/ typo in my blob key - its working!

No CORS or other configuration (besides the defaults set on fly.io deployment) was required either!

I believe the error above is another problem in my app (irrelevant to the question).

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.