# Getting build error after upgrading @uppy/aws-s3

**URL:** <https://community.transloadit.com/t/getting-build-error-after-upgrading-uppy-aws-s3/16804>\
**Category:** Uppy\
**Created:** [September 21, 2023, 12:58pm UTC](https://community.transloadit.com/t/getting-build-error-after-upgrading-uppy-aws-s3/16804 "2023-09-21T12:58:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![manojattal](https://yyz2.discourse-cdn.com/flex032/user_avatar/community.transloadit.com/manojattal/32/955_2.png) [@manojattal](https://community.transloadit.com/u/manojattal)\
**Post date:** [September 21, 2023, 12:58pm UTC](https://community.transloadit.com/t/getting-build-error-after-upgrading-uppy-aws-s3/16804/1 "2023-09-21T12:58:00Z")

</div>

Hello,

We are using uppy uploader in our react code to handle file uploading to s3. Currently our code makes use of 3.1.1 version of @uppy/aws-s3

But when we upgrade it to 3.2.0 or any other higher version, we are getting an error while building the react code.

Here is the partial code from tsx file. The code breaks on line getUploadParameters

```auto
useAwsS3(props: IProps) {
        this.uppy.use(AwsS3, {
            getUploadParameters: (file) => {
                return PD.Shared.Ajax.post<string>(props.getPreSignedUrl, {
                    fileName: file.name,
                    contentType: file.type
                })
                    .then(data => {
                        return {
                            method: "put",
                            url: data,
                            fields: {},
                            headers: {
                                'Content-Type': file.type,
                            },
                        };
                    });
            }
        });        
    }

```

We are getting following error when we try to build react project.

```auto
TS2322: Type '(file: UppyFile<Record<string, unknown>, Record<string, unknown>>) => Promise<{ method?: "POST"; url: string; fields?: Record<string, string>; expires?: number; headers?: Record<...>; } | { ...; } | { ...; }>' is not assignable to type '((file: UppyFile<Record<string, unknown>, Record<string, unknown>>) => MaybePromise<AwsS3UploadParameters>) | ((file: UppyFile<Record<...>, Record<...>>) => MaybePromise<...>)'.
  Type '(file: UppyFile<Record<string, unknown>, Record<string, unknown>>) => Promise<{ method?: "POST"; url: string; fields?: Record<string, string>; expires?: number; headers?: Record<...>; } | { ...; } | { ...; }>' is not assignable to type '(file: UppyFile<Record<string, unknown>, Record<string, unknown>>) => MaybePromise<AwsS3UploadParameters>'.
    Type 'Promise<{ method?: "POST"; url: string; fields?: Record<string, string>; expires?: number; headers?: Record<string, string>; } | { method?: "PUT"; url: string; fields?: Record<string, never>; expires?: number; headers?: Record<...>; } | { ...; }>' is not assignable to type 'MaybePromise<AwsS3UploadParameters>'.
      Type 'Promise<{ method?: "POST"; url: string; fields?: Record<string, string>; expires?: number; headers?: Record<string, string>; } | { method?: "PUT"; url: string; fields?: Record<string, never>; expires?: number; headers?: Record<...>; } | { ...; }>' is not assignable to type 'Promise<AwsS3UploadParameters>'.
        Type '{ method?: "POST"; url: string; fields?: Record<string, string>; expires?: number; headers?: Record<string, string>; } | { method?: "PUT"; url: string; fields?: Record<string, never>; expires?: number; headers?: Record<...>; } | { ...; }' is not assignable to type 'AwsS3UploadParameters'.
          Type '{ method?: "PUT"; url: string; fields?: Record<string, never>; expires?: number; headers?: Record<string, string>; }' is not assignable to type 'AwsS3UploadParameters'.
            Type '{ method?: "PUT"; url: string; fields?: Record<string, never>; expires?: number; headers?: Record<string, string>; }' is not assignable to type '{ method: "PUT"; url: string; fields?: Record<string, never>; expires?: number; headers?: Record<string, string>; }'.
              Property 'method' is optional in type '{ method?: "PUT"; url: string; fields?: Record<string, never>; expires?: number; headers?: Record<string, string>; }' but required in type '{ method: "PUT"; url: string; fields?: Record<string, never>; expires?: number; headers?: Record<string, string>; }'.
     96 | useAwsS3(props: IProps) {
     97 | this.uppy.use(AwsS3, {
  > 98 | getUploadParameters: (file) => {
        | ^^^^^^^^^^^^^^^^^^^
     99 | return PD.Shared.Ajax.post<string>(props.getPreSignedUrl, {
    100 | fileName: file.name,
    101 | contentType: file.type

```

Probably the issue seems to be related to [this](https://github.com/transloadit/uppy/pull/4299) PR.  
Can you someone give an idea about how to fix this?

---

<div class="post-metadata">

**Author:** ![Merlijn](https://yyz2.discourse-cdn.com/flex032/user_avatar/community.transloadit.com/merlijn/32/1382_2.png) [@Merlijn](https://community.transloadit.com/u/Merlijn)\
**Post date:** [September 21, 2023, 1:07pm UTC](https://community.transloadit.com/t/getting-build-error-after-upgrading-uppy-aws-s3/16804/2 "2023-09-21T13:07:47Z")

</div>

Hi, I think it’s more likely to be one of these commits on the types: [History for packages/@uppy/aws-s3-multipart/types/index.d.ts - transloadit/uppy · GitHub](https://github.com/transloadit/uppy/commits/main/packages/%40uppy/aws-s3-multipart/types/index.d.ts). Most likely this [commit](https://github.com/transloadit/uppy/commit/39e870f4875d1ec49e2b1ce59fa339101b47c4a3).

For now you can just use a `@ts-expect-error` and carry on. Contribution to fix would be very welcome!

---

<div class="post-metadata">

**Author:** ![manojattal](https://yyz2.discourse-cdn.com/flex032/user_avatar/community.transloadit.com/manojattal/32/955_2.png) [@manojattal](https://community.transloadit.com/u/manojattal)\
**Post date:** [September 21, 2023, 2:01pm UTC](https://community.transloadit.com/t/getting-build-error-after-upgrading-uppy-aws-s3/16804/3 "2023-09-21T14:01:56Z")

</div>

Thanks @Merlijn for the quick reply!  
Sure, I will setup dev env for Uppy and will give it a try to fix this.
