amplify-js icon indicating copy to clipboard operation
amplify-js copied to clipboard

custom attributes not works react amplify

Open gonzabt3 opened this issue 1 year ago • 1 comments

Before opening, please confirm:

JavaScript Framework

React

Amplify APIs

Authentication

Amplify Version

v6

Amplify Categories

auth

Backend

Amplify Gen 2 (Preview)

Environment information

# Put output below this line


Describe the bug

I am trying to define custom attributes but I have and error of typescript.I followed the official documentation


ERROR:
TypeScript validation check failed.
Resolution: Fix the syntax and type errors in your backend definition.

`import { defineAuth } from '@aws-amplify/backend';

/**
 * Define and configure your auth resource
 * @see https://docs.amplify.aws/gen2/build-a-backend/auth
 */
export const auth = defineAuth({
  loginWith: {
    email: true,
  },    
  userAttributes: {
    "custom:payed": {
      dataType: "Boolean",
      mutable: true,
    },
    "custom:is_trial_user": {
      dataType: "Boolean",
      mutable: true,
    },
    "custom:start_free_trial_date": {
      dataType: "DateTime",
      mutable: true,
    },
    "custom:end_free_trial_date": {
      dataType: "DateTime",
      mutable: true,
    },
  },
});`

Expected behavior

following the docs I need to add the prefix custom,

Reproduction steps

npm amps sandbox

Code Snippet

// Put your code below this line.



### Log output

<details>

// Put your logs below this line


</details>


### aws-exports.js

_No response_

### Manual configuration

_No response_

### Additional configuration

_No response_

### Mobile Device

_No response_

### Mobile Operating System

_No response_

### Mobile Browser

_No response_

### Mobile Browser Version

_No response_

### Additional information and screenshots

_No response_

gonzabt3 avatar Oct 08 '24 01:10 gonzabt3

Hello, @gonzabt3 and sorry to hear you're running into this issue. To better understand how you got here, can you clarify if you've already followed either our Quickstart Guide or the manual installation steps to set up your app? If so, can you share what you have in your package.json so we can see the dependencies? Thanks!

cwomack avatar Oct 08 '24 01:10 cwomack

Closing this issue as we have not heard back from you. If you are still experiencing this, please feel free to reply back and provide any information previously requested and we'd be happy to re-open the issue.

If there's further questions or issues with setting up the backend in the Gen 2 Developer Experience, please also review the existing issues (or open a new one) on the amplify-backend repository (here).

Thank you!

cwomack avatar Oct 22 '24 20:10 cwomack