Closed mehrdad-shokri closed 6 months ago
I have found out the root reason is importing import { SignInWithRedirectInput } from "@aws-amplify/auth/src/providers/cognito/types";
which is for declaring my function's parameter type. After changing the import from @aws-amplify/auth
the problem was fixed.
I ended up using react-hook-form
to handle form submission/validation. To pass the control
exported from useForm
call you can use something like this:
import {TextInput} from '@mantine/core';
import {Controller, FieldValues} from 'react-hook-form';
import {TextFieldControllerProps} from '@/types/props';
import styles from './TextFieldController.module.css';
const TextFieldController = <T extends FieldValues>({
control,
label,
placeholder,
name,
...textFieldProps
}: TextFieldControllerProps<T>) => {
return (
<Controller
name={name}
control={control}
render={({field}) => (
<TextInput
label={label}
required
withAsterisk={false}
placeholder={placeholder}
mb='lg'
size='md'
classNames={{
label: styles.label,
}}
{...textFieldProps}
{...field}
/>
)}
/>
);
};
export default TextFieldController;
error states and everything gets handled automatically. I didn't use the @mantine/form
solution because of form state not being provided.
HI @mehrdad-shokri thank you for opening this issue. Just to confirm your original issue was resolved by updating where your imports were coming from, correct?
Ex:
import { SignInWithRedirectInput } from "@aws-amplify/auth/src/providers/cognito/types"
vs
import { SignInWithRedirectInput } from "aws-amplify/auth"
Let me know if this is not the case or if you are still having questions.
Hello, yes the issue is resolved now after changing the import path to the mentioned ones.
Before opening, please confirm:
JavaScript Framework
Next.js
Amplify APIs
Authentication
Amplify Version
v6
Amplify Categories
auth
Backend
Amplify CLI
Environment information
Describe the bug
When trying to build
next.js
app router project, I get errorI think it's because type exports are not exported as
export type
.(this is required to do ifisolatedModules
is set to true) I can't setisolateModules
tofalse
in my project because it's mandatory bynext.js
to be true.(when trying to set it to false it resets it to false when building the project.) I can submit a pr to fix this issue if you want. I saw this prior bug report but there was not proper handling of this issue.Expected behavior
Build the project successfully without errors.
Reproduction steps
npm create amplify
npm run build
Code Snippet
Log output
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