Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unknown CDK when run command "npx ampx sandbox" #1743

Closed
iLoJokerZ opened this issue Jul 15, 2024 · 11 comments
Closed

Unknown CDK when run command "npx ampx sandbox" #1743

iLoJokerZ opened this issue Jul 15, 2024 · 11 comments
Labels
pending-triage Incoming issues that need categorization sandbox Related to the sandbox experience

Comments

@iLoJokerZ
Copy link

Environment information

Command: npx ampx sandbox
Output: 
Amplify Sandbox

  Identifier:   xxxx
  Stack:        xxxx

To specify a different sandbox identifier, use --identifier
Error: error: unknown command 'cdk'

Caused By: error: unknown command 'cdk'

Description

Hi Team,

Currently, I am using amplify 2 sandbox to testing my application in local. However, when I ran the command "npx ampx sandbox" it always returned the error "unknown command 'cdk'".

Here is my development environment version:
node: v20.11.1
npm: 10.5.2
cdk (I tried to install it but still had no luck): 2.149.0

@iLoJokerZ iLoJokerZ added the pending-triage Incoming issues that need categorization label Jul 15, 2024
@ykethan
Copy link
Member

ykethan commented Jul 15, 2024

Hey @iLoJokerZ, thank you for reaching out. Does the package.json contain the following packages?

"aws-cdk": "^2.148.1",
"aws-cdk-lib": "^2.148.1",
"constructs": "^10.3.0",

was the project was created using npm create amplify@latest?

@ykethan ykethan added sandbox Related to the sandbox experience pending-response Issue is pending response from author labels Jul 15, 2024
@iLoJokerZ
Copy link
Author

Hi @ykethan. Sure thing. I also tried uninstall and install again.
image

@github-actions github-actions bot removed the pending-response Issue is pending response from author label Jul 15, 2024
@ykethan
Copy link
Member

ykethan commented Jul 15, 2024

@iLoJokerZ how is the project currently setup? is this a monorepo?
Could you run npx ampx info and provide us the output?

@ykethan ykethan added the pending-response Issue is pending response from author label Jul 15, 2024
@iLoJokerZ
Copy link
Author

iLoJokerZ commented Jul 16, 2024

@ykethan, the project tends to build a lambda function, so it was based on the instruction in this link (https://docs.amplify.aws/react/build-a-backend/functions/set-up-function/). Moreover, I also used NestJS as a framework to implement a function.
Here is a information from npx ampx info

ampx info

Generates information for Amplify troubleshooting

Options:
--debug Print debug logs to the console [boolean] [default: false]
--help Show help [boolean]

Error: Command failed with exit code 1: npx cdk doctor --no-notices -- --no-color
error: unknown command 'cdk'
Error: Command failed with exit code 1: npx cdk doctor --no-notices -- --no-color
error: unknown command 'cdk'

@github-actions github-actions bot removed the pending-response Issue is pending response from author label Jul 16, 2024
@ykethan
Copy link
Member

ykethan commented Jul 16, 2024

Hey @iLoJokerZ, this appears to be an issue with the project setup and not the functions setup.
Is this a windows environment?
Could you provide us a screenshot of the project structure and package.json?
Would you be open for a reach out on discord? my handle is ykethan

@ykethan ykethan added the pending-response Issue is pending response from author label Jul 16, 2024
@iLoJokerZ
Copy link
Author

iLoJokerZ commented Jul 17, 2024

@ykethan

  • It is a windows environment
  • Here are the project structure and package.json

image

{
  "version": "1.0.0",
  "description": "This README would normally document whatever steps are necessary to get your application up and running.",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "@aws-amplify/backend": "^1.0.0",
    "@aws-amplify/backend-cli": "^1.0.1",
    "@aws-sdk/client-cognito-identity-provider": "^3.572.0",
    "@aws-sdk/client-lambda": "^3.572.0",
    "@eslint/js": "^9.2.0",
    "@stylistic/eslint-plugin": "^2.1.0",
    "@types/express": "^4.17.21",
    "@types/morgan": "^1.9.9",
    "@types/pg": "^8.11.6",
    "aws-cdk": "^2.149.0",
    "aws-cdk-lib": "^2.149.0",
    "constructs": "^10.3.0",
    "dotenv": "^16.4.5",
    "esbuild": "^0.20.2",
    "eslint": "^8.57.0",
    "eslint-plugin-import": "^2.29.1",
    "globals": "^15.2.0",
    "tsx": "^4.9.0",
    "typescript": "^5.4.5",
    "typescript-eslint": "^7.9.0"
  },
  "dependencies": {
    "@codegenie/serverless-express": "^4.14.1",
    "@googleapis/androidpublisher": "^16.0.0",
    "@isaacs/ttlcache": "^1.4.1",
    "@nestjs/common": "^10.3.10",
    "@sendgrid/client": "^8.1.3",
    "aws-sdk": "^2.1618.0",
    "axios": "^1.6.8",
    "body-parser": "^1.20.2",
    "cdk": "^2.149.0",
    "cron-parser": "^4.9.0",
    "express": "^4.19.2",
    "googleapis-common": "^7.2.0",
    "html-to-text": "^9.0.5",
    "joi": "^17.13.1",
    "jose": "^5.3.0",
    "jsonwebtoken": "^9.0.2",
    "jsrsasign": "^11.1.0",
    "morgan": "^1.10.0",
    "npx-cli": "^0.0.4",
    "object-path": "^0.11.8",
    "pg": "^8.11.5",
    "pg-hstore": "^2.3.4",
    "probe-image-size": "^7.2.3",
    "sequelize": "^6.37.3",
    "sequelize-typescript": "^2.1.6",
    "source-map-support": "^0.5.21"
  }
}

Is there any other way besides Discord, because I can't use Discord?

@github-actions github-actions bot removed the pending-response Issue is pending response from author label Jul 17, 2024
@ykethan
Copy link
Member

ykethan commented Jul 17, 2024

@iLoJokerZ, just to ensure is this the package.json under the Amplify folder or the root? As did observe the Amplify folder contains node_modules as well.

@ykethan ykethan added the pending-response Issue is pending response from author label Jul 17, 2024
@iLoJokerZ
Copy link
Author

Hi @ykethan, thanks for your suggestion. After I moved the package.json, the issue still there

@github-actions github-actions bot removed the pending-response Issue is pending response from author label Jul 18, 2024
@ykethan
Copy link
Member

ykethan commented Jul 19, 2024

Hey @iLoJokerZ, if you are unable to use discord. Could you provide us your email address to setup a call to dive into the issue?

@ykethan ykethan added the pending-response Issue is pending response from author label Jul 19, 2024
@iLoJokerZ
Copy link
Author

Hi @ykethan. My apologize for the late reply. About the issue, it is good now. I am not sure this is a good approach but it helps me solve the issue. I just reinstall my windows, and setup again then everything is good now.

Thank you for your time. We can close this topic.

@github-actions github-actions bot removed the pending-response Issue is pending response from author label Jul 23, 2024
@ykethan
Copy link
Member

ykethan commented Jul 23, 2024

Glad to hear you were able to mitigate the issue. Closing this issue, do reach out if you are still experiencing this.

@ykethan ykethan closed this as not planned Won't fix, can't repro, duplicate, stale Jul 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pending-triage Incoming issues that need categorization sandbox Related to the sandbox experience
Projects
None yet
Development

No branches or pull requests

2 participants