#✅ - Upgraded my Amplify data backend to the latest, and now I have multiple type errors. Build...

14 messages · Page 1 of 1 (latest)

flint geode
#

Here I have updated my data schema with the latest version, however a lot of my functions now have type errors which I can't figure why is there.

Error message:

util.d.ts(15, 130): The expected type comes from property 'jobCredit' which is declared here on type '{ [x: string]: string[]; id: string; }'```

Model schema: 
```Installer: a
    .model({
      id: a.id().required(),
      firstName: a.string(),
      lastName: a.string(),
      jobCredit: a.integer().default(5000),
    })
    .authorization((allow) => [allow.guest(), allow.authenticated()]),```
#

Another case where in my data schema the field is initialized as an integer but receives this error message.

violet mountain
#

Hi @flint geode this looks like errors similar to issues where the @aws-amplify/data-schema is not up to date. Can you please run the following command in your project directory and share the output?

npm list @aws-amplify/data-schema
flint geode
#

Hi, this is the output

violet mountain
#

hmm, that seems up to date

#

maybe try restarting the TS server?

flint geode
#

I tried restarting the TS server but no luck..

violet mountain
#

Would you be able to share your package.json file? And, just might be worth a try, deleting node_modules and package-lock.json, then re-install your dependencies?

flint geode
#

Hi, here is my package.json

#

I did try deleting node_modules and re-install, but also no lucl

flint geode
#

I notice that these happens on update(), and create()

await client.models.Progress.update({
      id: progressId,
      dateCompleted: dateCompleted,
    });

My workaround for now (not ideal) since I have to build the platform is to update this payload 's type to any such as

await client.models.Progress.update({
      id: progressId,
      dateCompleted: dateCompleted,
    } as any);

Only this could fix the build errors for me

violet mountain
#

Hi @flint geode apologies for the delayed response. just curious if you are still experiencing and blocked by this issue with the latest versions of the amplify libraries?

please try running:

npm install @aws-amplify/backend@latest @aws-amplify/backend-cli@latest
npm update @aws-amplify/data-schema
unreal mapleBOT
#

✅ - Upgraded my Amplify data backend to the latest, and now I have multiple type errors. Build...