You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

升级AWS Amplify至5.3.7后configure方法报错求助

aws-amplify 升级至5.3.7版本后的未解决问题

将NodeJS项目中的aws-amplify库升级至5.3.7版本后,多数破坏性变更问题已修复,但仍存在两个未解决问题。

更新后的package.json文件内容如下:

{
  "name": "project",
  "private": true,
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start",
    "lint": "next lint"
  },
  "dependencies": {
    "@fortawesome/fontawesome-svg-core": "^6.4.2",
    "@fortawesome/free-brands-svg-icons": "^6.4.2",
    "@fortawesome/free-solid-svg-icons": "^6.4.2",
    "@fortawesome/react-fontawesome": "^0.2.0",
    "@types/nprogress": "^0.2.0",
    "aws-amplify": "^5.3.7",
    "axios": "^1.4.0",
    "colors": "^1.4.0",
    "next": "13.4.16",
    "nprogress": "^0.2.0",
    "react": "18.2.0",
    "react-dom": "18.2.0",
    "react-dropzone": "^14.2.3",
    "react-select": "^5.7.4",
    "sass": "^1.65.1"
  },
  "devDependencies": {
    "@types/node": "^20.5.0",
    "@types/react": "18.2.20",
    "eslint": "8.47.0",
    "eslint-config-next": "13.4.16",
    "typescript": "5.1.6"
  }
}

第一个错误出现在代码行 Amplify.configure(AmplifyConfig);,TypeScript提示“property configure does not exist on type typeof....”。配置从单独的TypeScript文件导入:import { AmplifyConfig } from "../configs";,配置内容如下:

export const AmplifyConfig = {
  Auth: {
    // REQUIRED only for Federated Authentication - Amazon Cognito Identity Pool ID
    identityPoolId: "<>",

    // REQUIRED - Amazon Cognito Region
    region: "<>",

    // OPTIONAL - Amazon Cognito Federated Identity Pool Region
    // Required only if it's different from Amazon Cognito Region
    identityPoolRegion: "<>",

    // OPTIONAL - Amazon Cognito User Pool ID
    userPoolId: "<>",

    // OPTIONAL - Amazon Cognito Web Client ID (26-char alphanumeric string)
    userPoolWebClientId: "<>",

    oauth: {
      domain: "XXXXXXXXX.com",
      scope: [
        "phone",
        "email",
        "openid",
        "profile",
        "aws.cognito.signin.user.admin",
      ],
      redirectSignIn: process.env.PROD_CALLBACK_URL,
      redirectSignOut: process.env.PROD_SIGNOUT_URL,
      responseType: "token", // or 'token', note that REFRESH token will only be generated when the responseType is code
    },
  },
  ssr: true,
};

内容的提问来源于stack exchange,提问作者vinod827

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.13 16:12:49