Troubleshooting issues with the Amazon Q Developer Agent for code transformation
The following information can help you troubleshoot common issues with the Amazon Q Developer Agent for code transformation.
Topics
- Why can't Amazon Q upload my project?
- Why are my Maven commands failing?
- How do I add Maven to my PATH?
- Why can't Amazon Q build my code?
- Why did my transformation fail after 55 minutes?
- Why can’t I download my transformed code?
- How do I access code transformation logs?
- How do I find my transformation job ID?
Why can't Amazon Q upload my project?
If your project fails to upload, it’s likely due to one of the following issues. See the topic that corresponds to the error you see from Amazon Q.
Reduce project size
To transform your code, Amazon Q generates a project artifact, which includes your source code, project dependencies, and build logs. The maximum project artifact size for a transformation job is 2 GB. If you get an error related to project artifact size, you must decrease the size of your project or try transforming a smaller project. You can view the size of your project artifact file in the code transformation logs. For more information, see How do I access code transformation logs?
Configure proxy settings in your IDE
To transform your code, Amazon Q uploads your project artifact to a service-owned Amazon S3 bucket. Part of the upload process involves using SSL or TLS certificates to establish communication between Amazon S3 and your IDE. If you are using a proxy server, the SSL or TLS certificates used by your proxy server must be trusted, otherwise Amazon Q is not able to upload your project.
If you receive an error related to your proxy or certificates, you likely need to configure your IDE or operating system to trust your certificates or update other proxy settings.
Note
You might also encounter issues unrelated to certificates if you are behind your organization’s proxy server or firewall. If you complete the following procedures to configure your certificates and still have issues, contact your network administrator to ensure you are allowed to communicate with Amazon S3 from your IDE. For more information, see Allow access to Amazon S3.
Configure certificates in JetBrains
To configure your JetBrains IDE Java Runtime Environment (JRE) to trust the SSL or
TLS certificates used by your proxy server, you must import the SSL or TLS
certificates to the cacerts
file in the JRE. The cacerts
file is a file that contains trusted root certificates for secure connections such
as HTTPS and SSL, and it's part of the JRE's security settings. To import a
certificate, complete the following procedure.
Note
We recommend making a backup of the cacerts
file before modifying
it, as any mistakes can cause issues with secure connections.
-
Determine the path to the
cacerts
file in your JRE. The path of thecacerts
file in the internal JRE shipped with your JetBrains IDE depends on the operating system and the version of the JetBrains IDE you’re using.Following are examples of paths to the
cacerts
file in common operating systems. Choose your operating system to see examples.Note
<JetBrains Installation Folder>
refers to the directory where JetBrains products are installed. This directory is typically chosen during the installation process.The
jbr
folder represents the JRE bundled with JetBrains IDEs, which is a specific version of the JRE tailored for use with JetBrains IDEs. -
Determine the certificate you need to import to the
cacerts
file. The certificate file typically has a.cer
,.crt
, or.der
file extension. If you aren’t sure which certificates you need to add, contact your network administrator. -
Import the certificate to the
cacerts
keystore. You can do this with the Javakeytool
command.-
Open a command prompt and enter the following command:
keytool -import -alias <alias> -file <certificate_file> -keystore <path_to_cacerts>
-
For
<alias>
, you can add a name for the certificate you are importing to refer to it later. This option is optional. -
For
<certificate_file>
, specify the path to the certificate you are importing. This should be a path to the.cer
,.crt
, or.der
file containing the certificate. -
For
<path_to_cacerts>
, specify the path to thecacerts
keystore file you saved in step 1. This is the file where you are importing the certificate.
For example, if you want to import a certificate named
my_certificate.cer
into thecacerts
keystore of the bundled JRE in IntelliJ IDEA on Windows, and you want to give the aliasmyalias
to the certificate, the command might be:keytool -import -alias myalias -file my_certificate.cer -keystore "C:\Program Files\JetBrains\IntelliJ IDEA 2022.3.2\jbr\bin\cacerts"
-
-
During the import process, you'll be prompted to enter the keystore password. The default password for the
cacerts
keystore ischangeit
. -
After running the command, you'll be asked to trust the certificate. To confirm the certificate is trusted and complete the import, enter
yes
. -
You might also need to add the certificates to the IDE itself, in addition to the JRE. For more information, see Server Certificates
in the JetBrains documentation.
Configure certificates in Visual Studio Code
To configure Visual Studio Code to trust the SSL or TLS certificates used by your proxy server, make sure you have configured the following proxy settings for your operating system.
Configure the following proxy settings for Visual Studio Code on macOS.
Add certificates to your macOS keychain
If you haven’t already, you must add the certificates used by your proxy
server to your macOS keychain. For information on adding
certificates to your keychain, see Add certificates to a keychain using Keychain Access on Mac
Install the Mac CA VSCode extension
The
Mac CA VSCode extension
To install the extension:
-
Search for
mac-ca-vscode
in the VS Code extensions pane, and choose Install. -
Restart VS Code.
Update proxy settings in VS Code on macOS
Update the following settings to make sure VS Code is configured properly for your proxy.
-
Open settings in VS Code.
-
Enter
proxy
in the search bar. -
In the Http: Proxy field, add your proxy URL.
-
Deselect Http: Proxy Strict SSL.
-
In the Http: Proxy Support dropdown list, choose on.
-
In the settings search bar, enter
http.experimental.systemCertificatesV2
. Select Http › Experimental: System Certificates V2.
Configure the following proxy settings for Visual Studio Code on Windows.
Add certificate as a trusted root certificate on Windows
If you haven't already, you must add the certificates used by your proxy server to your Trusted Root Certification Authorities store on Windows. To add a certificate, complete the following procedure:
-
Open the search tool or a Run command window.
-
Enter the following to open the Certificate Manager tool:
certmgr.msc
-
Choose the Trusted Root Certification Authorities store.
-
Right-click Certificates, choose All Tasks, and then choose Import....
-
Follow the instructions given to import your proxy certificate.
-
After you've imported your certificate, confirm the certificate was added.
In the Trusted Root Certification Authorities store, double click Certificates. Right-click the certificate you added and choose Properties. Under Certificate purposes, the option Enable all purposes for this certificate should be selected.
Install the Win-CA VSCode extension
The Win-CA VSCode extension
To install the extension:
-
Search for
win-ca
in the VS Code settings pane. -
In the Inject dropdown list, choose append.
Update proxy settings in VS Code on Windows
Update the following settings to make sure VS Code is configured properly for your proxy.
-
Open settings in VS Code.
-
Enter
proxy
in the search bar. -
In the Http: Proxy field, add your proxy URL.
-
Deselect Http: Proxy Strict SSL.
-
In the Http: Proxy Support dropdown list, choose on.
-
In the settings search bar, enter
http.experimental.systemCertificatesV2
. Select Http › Experimental: System Certificates V2. -
Restart VS Code.
Allow access to Amazon S3
During a transformation, the Amazon Q Developer Agent for code transformation uploads your code to a service-owned Amazon S3 bucket. If your network or organization hasn’t configured access to Amazon S3, Amazon Q isn’t able to upload your project.
To ensure Amazon Q can upload your project, make sure your proxy configuration and other network components, such as Data Lost Prevention (DLP) policies, are configured to allow access to Amazon S3. You might also need to allowlist the Amazon S3 bucket where Amazon Q uploads your project. For more information, see Data perimeters for Amazon Q resources.
If you transform a large project, DLP policies or other network components might cause delays and prevent a successful upload if they aren’t configured to allowlist the Amazon S3 bucket. If you choose not to allowlist the bucket, you might need to transform a smaller project so that Amazon Q can upload it.
Why are my Maven commands failing?
Following are Maven configuration issues that you might see in the JetBrains and Visual Studio Code IDEs. If you address the issues and still see Maven errors, there might be an issue with your project. Use the information in the error logs to address any issues with your project, and then try transforming your project again.
Update Maven configuration in JetBrains
If a transformation fails in JetBrains due to Maven command issues, the error logs appear on the Run tab. Use the information in the logs to address the issue. Following are some issues that you might need to address:
-
Make sure that your Maven home path is set to Bundled. Go to Settings, and then expand the Build, Execution, Deployment section. Expand the Build Tools section and then expand Maven. In the Maven home path dropdown list, choose Bundled.
-
Make sure that the Java runtime environment (JRE) is using your project JDK. Go to Settings, and then expand the Build, Execution, Deployment section. Expand Maven and choose Runner. In the JRE dropdown list, choose Use Project JDK.
-
Make sure that Maven is enabled. Go to Settings and choose Plugins. Search for Maven and choose the Maven plugin. If you see an Enable button, choose it to enable Maven.
Update Maven configuration in Visual Studio Code
If a transformation fails in VS Code because of Maven command issues, a text file that contains the error logs opens in a new tab. Use the information in the logs to address the issue.
Make sure that you have configured either one of the following options:
-
Your project contains a Maven wrapper in the project root folder
-
A version of Maven supported by Amazon Q is available on your
PATH
For more information, see How do I add Maven to my PATH?
How do I add Maven to my PATH
?
To transform your code in VS Code without using a Maven wrapper, you must install
Maven and add it to your PATH
variable.
To check if you have Maven installed correctly already, run mvn -v
in a
new OS terminal outside of Visual Studio Code. You should see an output with your Maven version.
If you get an output in your Visual Studio Code terminal but not in your OS terminal, or if the
command isn't found, you need to add Maven to your PATH
.
To add Maven to your PATH
, follow the instructions for your
machine.
Why can't Amazon Q build my code?
If the transformation fails when Amazon Q is building your code, your project may not be configured properly for the environment where Amazon Q builds your code. You might need to update your build configuration or code implementation.
Review the build log output Amazon Q provides to determine if there are changes you can make to your project. Following are some common issues that might prevent Amazon Q from building your code.
Remove absolute paths in pom.xml
If you have an absolute path in your pom.xml file, Amazon Q won’t be able to find the relevant files, and as a result might not be able to build your code.
Following is an example of an absolute path that you could have in your pom.xml
file:
<toolspath> <path>/Library/Java/JavaVirtualMachines/jdk-11.0.11.jdk/Contents/Home/lib/tools.jar</path> </toolspath>
Instead of using an absolute path, you can create a relative path using a pointer. Following is an example of how you can replace the previous absolute path with a relative path:
<toolspath> <path>${java.home}/../lib/tools.jar</path> </toolspath>
Remove local or external databases in unit tests
Amazon Q runs any unit tests in your project when it builds your code. If a unit test calls a local or external database, Amazon Q won’t have access to the database, causing the build to fail. To prevent the build from failing, you must either remove the database call from the unit test or remove the unit test before submitting the transformation.
Why did my transformation fail after 55 minutes?
If your code transformation job fails after 55 minutes, your code build time likely exceeds the build time limit. There is currently a time limit of 55 minutes for building your code.
If your local build time takes 55 minutes or longer, reduce your project’s build time to transform your code. If your local build is faster than the build with Code Transformation, check your project for tasks that might be failing or take a longer time in a different environment. Consider disabling long-running test cases. Also consider using timeouts for attempts to access resources that might not be available from the secure IDE environment or the internet.
Why can’t I download my transformed code?
If you aren’t able to download your code after your transformation is complete, it’s likely due to one of the following issues. See the topic that corresponds to the error you see from Amazon Q.
Topics
Reduce project size
After the transformation is complete, Amazon Q generates an output artifact that contains a diff with your upgraded code and a transformation summary with information about the changes it made. The output artifact must be 1 GB or less in order for the IDE to download it.
If the output artifact exceeds the limit, you will not be able to download your upgraded code or transformation summary. Try transforming a smaller project to prevent a large output artifact. If the issue persists, contact AWS Support. For information about contacting AWS Support with Amazon Q, see Using Amazon Q Developer to chat with AWS Support.
Download code diff within 24 hours
The code diff file with your upgraded code is only available for 24 hours after the transformation is complete. If it’s been over 24 hours since the transformation completed, restart the transformation to download the diff file.
Configure proxy settings in your IDE
The Amazon Q Developer Agent for code transformation downloads your upgraded code from a service-owned Amazon S3 bucket. Part of the download process involves using SSL or TLS certificates to establish communication between Amazon S3 and your IDE. If you are using a proxy server, the SSL or TLS certificates used by your proxy server must be trusted, otherwise Amazon Q is not able to upload your project.
To download your code, you might need to configure your IDE to trust certificates or update other proxy settings. For more information on updating your proxy settings, see Configure proxy settings in your IDE.
Remove wildcard characters in JetBrains proxy settings
If you have configured proxy settings in your JetBrains IDE, you might see the following error when downloading your upgraded code:
software.amazon.awssdk.core.exception.SdkClientException: Unable to execute HTTP request: Dangling meta character '*' near index 0
This is likely caused by the presence of a wildcard character (*) in the No proxy for field of your IDE's proxy settings. The Java SDK used by the Amazon Q Developer Agent for code transformation doesn't support wildcard entries in this field.
To download your code, remove any wildcards from the No proxy
for field, and then restart your IDE. If you need to specify hosts that
should bypass the proxy, use a regular expression instead of a wildcard. To update
proxy settings in your JetBrains IDE, see HTTP
Proxy
How do I access code transformation logs?
Access logs in JetBrains
For information about how to access JetBrains log files, see Locating IDE log files
To find logs emitted by the Amazon Q Developer Agent for code transformation in JetBrains, search the IDE logs for the following string:
software.aws.toolkits.jetbrains.services.codemodernizer
Code transformation logs start with the preceding string. Logs generated by Maven are displayed on the Run tab and have the preceding string before and after the log entry.
Access logs in Visual Studio Code
To find logs emitted by the Amazon Q Developer Agent for code transformation in VS Code, complete the following steps:
-
Choose View in the top navigation bar, and then choose Command Palette.
-
Search
Amazon Q: View Logs
in the command palette that appears. -
The logs open in the IDE. To search the log files for
CodeTransformation
, useCMD + F
orControl + F
.
Code transformation logs in VS Code are prefixed with
CodeTransformation:
. Following is an example of a log generated in
VS Code for a Maven copy dependencies error:
2024-02-12 11:29:16 [ERROR]: CodeTransformation: Error in running Maven copy-dependencies command mvn = /bin/sh: mvn: command not found
How do I find my transformation job ID?
Find your job ID in JetBrains
To find a transformation job ID in JetBrains, go to the Transformation details tab in the Transformation Hub and choose the Show Job Status (clock) icon.
Find your job ID in Visual Studio Code
To find a transformation job ID in VS Code, go to the Transformation Hub and choose the Show Job Status (clock) icon.