aws / aws-toolkit-vscode

Amazon Q, CodeCatalyst, Local Lambda debug, SAM/CFN syntax, ECS Terminal, AWS resources
https://marketplace.visualstudio.com/items?itemName=AmazonWebServices.amazon-q-vscode
Apache License 2.0
1.45k stars 377 forks source link

CodeWhisperer does nothing in my VSCode environment #4190

Open upmyoung opened 8 months ago

upmyoung commented 8 months ago

Problem

CodeWhisperer just flat out doesn't work for me after configuring it with a Builder ID on VSCode. Q does work fine.

Steps to reproduce the issue

  1. Configure AWS Toolkit with Builder ID - VSCode shows AWS: AWS Builder ID at the bottom with a check mark. Clicking on that shows AWS Builder ID connected to CodeWhisperer
  2. Click on the AWS item on left menu, and select CodeWhisperer - Learn
  3. Select Generate Code Suggestions as you type - get the new window with example code
  4. Hit Enter after line 5 as instructed - nothing happens
  5. Try Alt+C - CW appears to be trying, but a message "No Suggestions from CodeWhisperer" appears and quickly disappears.

Expected behavior

I expected CW to provide a code suggestion as shown in several informational videos on YouTube show

System details (run the AWS: About Toolkit command)

justinmk3 commented 8 months ago

Can you provide the Toolkit logs (check that private info is removed)?

  1. In VSCode settings, ensure that "aws log level" is "debug".
  2. Perform the steps to reproduce the issue.
  3. Use the AWS: View Toolkit Logs command to get the logs.
upmyoung commented 8 months ago

log.txt Log enclosed.

justinmk3 commented 8 months ago
2023-12-19 13:05:19 [ERROR]: CodeWhisperer Invocation Exception : Cannot redefine property: default
...
2023-12-19 13:05:19 [ERROR]: Error TypeError: Tn?.includes is not a function in getPaginatedRecommendation

That looks like a bug and will help lead to a fix, thank you!

upmyoung commented 8 months ago

Please do not hesitate to ask if you need any more info from me!

justinmk3 commented 8 months ago

@upmyoung could you try the prerelease? https://github.com/aws/aws-toolkit-vscode/releases/tag/prerelease

upmyoung commented 7 months ago

OK I have tried the prerelease: OS: Windows_NT x64 10.0.22631 Visual Studio Code extension host: 1.85.1 AWS Toolkit: 2.5.0-7c4e848 node: 18.15.0 electron: 25.9.7

and the behavior has changed, but it still doesn't work. I enclose the toolkit logs log.txt

I repeated the steps outlined above

Will-ShaoHua commented 7 months ago

@upmyoung curious were you able to see CW recommendations in your own files instead of CW's learn example files in the repro step? For example simply create a new file on your own and try trigger CW service

vdesaintpern commented 7 months ago

Running into the same issue on Code-OSS in Sagemaker. Install from prereleased removed the Error but code whisperer is not offering code suggestions. Same install in VSCode with same connection type (builder ID) on my local laptop works.

Also getting this error : 2024-01-10 17:34:04 [ERROR]: CodeWhisperer Invocation Exception : Unexpected key 'optOutPreference' found in params

upmyoung commented 6 months ago

@Will-ShaoHua no, when I try to trigger the CW service in a new file, nothing happens. The logs contain the following error message: 2024-01-22 16:16:23 [ERROR]: CodeWhisperer Invocation Exception : Cannot redefine property: default

leigaol commented 6 months ago

@upmyoung Can you try this private build? With this build, you should be able to find the exact stack trace of this exception. aws-toolkit-vscode-2.8.0-dd93682.zip Thank you!

upmyoung commented 6 months ago

Will do.

Will-ShaoHua commented 6 months ago

Thanks for the help @upmyoung, having this request is because our team doesn't have any helpful finding so far on this issue. It would be helpful if you can provide us the stack trace (which should be available in this private build)

Will-ShaoHua commented 6 months ago

@vdesaintpern thanks for reporting us, I think it's a different issue based on the error message, wondering could you cut another issue for your case and provide us repro steps and extension version to us? Thanks a lot!

Will-ShaoHua commented 6 months ago

stacktrace

2024-01-30 15:19:17.869 [info] TypeError: Cannot redefine property: default
    at Function.defineProperty (<anonymous>)
    at c:\Users\bradkno\.vscode\extensions\amazonwebservices.aws-toolkit-vscode-2.8.0-dd93682\dist\src\main.js:57:6236
    at Array.forEach (<anonymous>)
    at g (c:\Users\bradkno\.vscode\extensions\amazonwebservices.aws-toolkit-vscode-2.8.0-dd93682\dist\src\main.js:57:6183)
    at constructor.loadFrom (c:\Users\bradkno\.vscode\extensions\amazonwebservices.aws-toolkit-vscode-2.8.0-dd93682\dist\src\main.js:57:6866)
    at N (c:\Users\bradkno\.vscode\extensions\amazonwebservices.aws-toolkit-vscode-2.8.0-dd93682\dist\src\main.js:50:14429)
    at constructor.region (c:\Users\bradkno\.vscode\extensions\amazonwebservices.aws-toolkit-vscode-2.8.0-dd93682\dist\src\main.js:50:15405)
    at constructor.set (c:\Users\bradkno\.vscode\extensions\amazonwebservices.aws-toolkit-vscode-2.8.0-dd93682\dist\src\main.js:45:181109)
    at constructor.<anonymous> (c:\Users\bradkno\.vscode\extensions\amazonwebservices.aws-toolkit-vscode-2.8.0-dd93682\dist\src\main.js:45:179164)
    at constructor.each (c:\Users\bradkno\.vscode\extensions\amazonwebservices.aws-toolkit-vscode-2.8.0-dd93682\dist\src\main.js:67:15974)
    at new constructor (c:\Users\bradkno\.vscode\extensions\amazonwebservices.aws-toolkit-vscode-2.8.0-dd93682\dist\src\main.js:45:179125)
    at g.constructor.g.constructor.initialize (c:\Users\bradkno\.vscode\extensions\amazonwebservices.aws-toolkit-vscode-2.8.0-dd93682\dist\src\main.js:53:22783)
    at g.constructor.g.constructor.constructor (c:\Users\bradkno\.vscode\extensions\amazonwebservices.aws-toolkit-vscode-2.8.0-dd93682\dist\src\main.js:53:22691)
    at new g.constructor.g.constructor (c:\Users\bradkno\.vscode\extensions\amazonwebservices.aws-toolkit-vscode-2.8.0-dd93682\dist\src\main.js:67:17875)
    at new constructor (c:\Users\bradkno\.vscode\extensions\amazonwebservices.aws-toolkit-vscode-2.8.0-dd93682\dist\src\main.js:53:22552)
    at UHe.createAwsService (c:\Users\bradkno\.vscode\extensions\amazonwebservices.aws-toolkit-vscode-2.8.0-dd93682\dist\src\main.js:3951:1068)
    at async OEe.createUserSdkClient (c:\Users\bradkno\.vscode\extensions\amazonwebservices.aws-toolkit-vscode-2.8.0-dd93682\dist\src\main.js:3579:820)
    at async OEe.listRecommendations (c:\Users\bradkno\.vscode\extensions\amazonwebservices.aws-toolkit-vscode-2.8.0-dd93682\dist\src\main.js:3579:1464)
    at async Hh.getServerResponse (c:\Users\bradkno\.vscode\extensions\amazonwebservices.aws-toolkit-vscode-2.8.0-dd93682\dist\src\main.js:4247:1292)
    at async Hh.getRecommendations (c:\Users\bradkno\.vscode\extensions\amazonwebservices.aws-toolkit-vscode-2.8.0-dd93682\dist\src\main.js:4247:2941)
    at async Yu.getPaginatedRecommendation (c:\Users\bradkno\.vscode\extensions\amazonwebservices.aws-toolkit-vscode-2.8.0-dd93682\dist\src\main.js:4271:1749)
    at async cu.generateRecommendation (c:\Users\bradkno\.vscode\extensions\amazonwebservices.aws-toolkit-vscode-2.8.0-dd93682\dist\src\main.js:4274:933)
    at async jp.invokeAutomatedTrigger (c:\Users\bradkno\.vscode\extensions\amazonwebservices.aws-toolkit-vscode-2.8.0-dd93682\dist\src\main.js:4277:1504)
    at async jp.processKeyStroke (c:\Users\bradkno\.vscode\extensions\amazonwebservices.aws-toolkit-vscode-2.8.0-dd93682\dist\src\main.js:4277:1353)
    at async f.value (c:\Users\bradkno\.vscode\extensions\amazonwebservices.aws-toolkit-vscode-2.8.0-dd93682\dist\src\main.js:4330:4086)
2024-01-30 15:19:17.871 [error] CodeWhisperer Invocation Exception : Cannot redefine property: default
Will-ShaoHua commented 6 months ago

environment Version: 1.85.2 (system setup) Commit: 8b3775030ed1a69b13e4f4c628c612102e30a681 Date: 2024-01-18T06:40:10.514Z Electron: 25.9.7 ElectronBuildId: 26354273 Chromium: 114.0.5735.289 Node.js: 18.15.0 V8: 11.4.183.29-electron.0 OS: Windows_NT x64 10.0.19045

upmyoung commented 6 months ago

OK, sorry for the delay. I installed the private build: OS: Windows_NT x64 10.0.22631 Visual Studio Code extension host: 1.85.2 AWS Toolkit: 2.8.0-dd93682 node: 18.15.0 electron: 25.9.7 on the latest VSCode:

Version: 1.85.2 (user setup) Commit: 8b3775030ed1a69b13e4f4c628c612102e30a681 Date: 2024-01-18T06:40:10.514Z Electron: 25.9.7 ElectronBuildId: 26354273 Chromium: 114.0.5735.289 Node.js: 18.15.0 V8: 11.4.183.29-electron.0 OS: Windows_NT x64 10.0.22631

I enclose a zip file with two logs: aws_toolkit_20240129T114516.log contains the results of trying to use the "guided" CodeWHisperer tools aws_toolkit_20240125T135618-1.log contains the results of trying to use CW in a test file, trying to get it to suggest some code. ToolkitLogs.zip

Will-ShaoHua commented 6 months ago

thanks a lot @upmyoung, it seems something goes wrong while initializing the sdk client in this case. We're actively looking into this issue, again thanks for your patience!