Skip to content

Conversion of type 'ProcessEnv' to type 'LambdaProvidedEnvVars & AmplifyBackendEnvVars' may be a mistake #1854

Open
@vinothj-aa

Description

@vinothj-aa

Environment information

System:
  OS: macOS 14.5
  CPU: (10) arm64 Apple M1 Pro
  Memory: 144.94 MB / 16.00 GB
  Shell: /bin/zsh
Binaries:
  Node: 22.6.0 - ~/.nvm/versions/node/v22.6.0/bin/node
  Yarn: undefined - undefined
  npm: 10.8.2 - ~/.nvm/versions/node/v22.6.0/bin/npm
  pnpm: undefined - undefined
NPM Packages:
  @aws-amplify/backend: 1.0.3
  @aws-amplify/backend-cli: 1.0.4
  aws-amplify: 6.3.7
  aws-cdk: 2.147.0
  aws-cdk-lib: 2.147.0
  typescript: 5.5.2
AWS environment variables:
  AWS_STS_REGIONAL_ENDPOINTS = regional
  AWS_NODEJS_CONNECTION_REUSE_ENABLED = 1
  AWS_SDK_LOAD_CONFIG = 1
No CDK environment variables

Description

I'm running to an issue in personal cloud sandbox environment with the error:

.amplify/generated/env/add-user-to-group.ts(2,20): error TS2352: Conversion of type 'ProcessEnv' to type 'LambdaProvidedEnvVars & AmplifyBackendEnvVars' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
  Type 'ProcessEnv' is missing the following properties from type 'LambdaProvidedEnvVars': _HANDLER, _X_AMZN_TRACE_ID, AWS_DEFAULT_REGION, AWS_REGION, and 20 more.
TypeScript validation check failed.
Resolution: Fix the syntax and type errors in your backend definition.

This is leading to build failures in Amplify as well.

Since the file that throws this error is an auto generated file by Amplify, I'm not sure how to fix this issue!

Steps tried by me:

  • Deleted the sandbox environment & recreated but no luck.
  • Deleted .amplify folder to auto generate it from the scratch but no luck
  • I used npx command with --debug flag but gives the same error message without additional details
  • Tried to switch to a different working branch in BitBucket and the issue doesn't occur but there is no code difference between the two branches.

Additional Details:

./tsconfig.json
{
  "compilerOptions": {
    "target": "es2017",
    "lib": ["dom", "dom.iterable", "esnext"],
    "allowJs": true,
    "skipLibCheck": true,
    "strict": true,
    "noEmit": true,
    "esModuleInterop": true,
    "module": "esnext",
    "moduleResolution": "bundler",
    "resolveJsonModule": true,
    "isolatedModules": true,
    "jsx": "preserve",
    "incremental": true,
    "plugins": [
      {
        "name": "next"
      }
    ],
    "paths": {
      "@/*": ["./*"]
    }
  },
  "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
  "exclude": ["node_modules", ".amplify", "./amplify"]
}

I couldn't find help in the Amplify documentation and online as well. I would really appreciate it if someone could help me.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingsandboxRelated to the sandbox experience

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions