When I try to retrieve AWS Lambda function source code, I receive the "Unable to retrieve code template for the selected runtime" or "Unable to retrieve source code of your Lambda function" error.
Short description
When browser settings, network configurations, firewalls, or security policies block access to AWS domains, you can't retrieve the function code. The error affects the Lambda console, but you can still manage the Lambda function through the AWS Command Line Interface (AWS CLI) or AWS CloudShell.
Resolution
Check your browser configuration
Browser extensions, cached data, or security settings can cause the Lambda console not to load the function code.
Test in incognito or private browsing mode
Complete the following steps:
- Open an incognito window in Google Chrome or a private window in Firefox or Microsoft Edge.
- Open the Lambda console.
- Check whether the Lambda function source code loads.
If the function code loads in incognito mode, then browser extensions or cached data might cause the issue. Incognito mode doesn't bypass your organization's extensions or policies.
Clear browser cache and cookies
Complete the following steps:
- Clear your browser's cache and cookies for all AWS domains.
- Close and restart your browser.
- Open the Lambda console.
- Check whether the Lambda function source code loads.
Turn off browser extensions
Complete the following steps:
- Turn off all browser extensions, ad blockers, security extensions, and content filtering extensions.
- Restart your browser.
- Open the Lambda console.
- Turn on an extension, and then check whether the Lambda source code loads. Repeat this step for each extension to identify the one that caused the issue.
Test with multiple browsers
To determine whether the issue is browser specific, test the Lambda console with Chrome, Firefox, and Edge. If the issue occurs across all browsers, then network configurations might be the cause.
Check network and VPN configuration
Network restrictions, VPN connections, or proxy servers can block access to AWS content delivery domains.
Disconnect from VPN or proxy
Complete the following steps:
- (Optional) If you're connected to a VPN or use a proxy server, then disconnect from the connection.
- Open the Lambda console directly through your internet connection.
- Check whether the Lambda function source code loads.
If the function code loads without the VPN or proxy, then your VPN or proxy configuration blocks access to the required AWS domains.
Test on a different network
Complete the following steps:
- Connect to a different network, such as a mobile hotspot or local network.
- Open the Lambda console.
- Check whether the Lambda function source code loads.
If the function code loads on a different network, then your original network has restrictions that block AWS console resources.
Verify firewall and security policies
Corporate firewalls, security software, or network policies can block access to AWS domains that are required for the Lambda console.
Allow required AWS domains
Check with your network administrator to make sure that your firewall or security policies allow traffic to the following AWS domains:
- a2z.com
- amazon.com
- amazonaws.com
- aws
- aws.com
- aws.dev
- awscloud.com
- awsplayer.com
- awsstatic.com
- cloudfront.net
- live-video.net
The Lambda console uses the preceding AWS domains to retrieve code templates and display function source code. For more information, see The page isn't loading properly.
Check local security software
Complete the following steps:
- Temporarily turn off antivirus software, firewall software, or security applications on your local machine.
- Open the Lambda console.
- Check whether the Lambda function source code loads.
- Turn on the antivirus software, firewall software, or security applications, and then configure your security software to allow access to the required AWS domains.
Check system settings
System-level settings can affect console connectivity and functionality. If your system clock is incorrect, then your browser can't establish a TLS connection to AWS endpoints.
Check date and time synchronization
Take the following actions:
- Confirm that your system date and time are correct and synchronized.
- Confirm that your time zone is set correctly.
- If you adjust the date or time, then restart your browser and try to load the source code on the Lambda console again.
Restart your system
System restarts can resolve temporary configuration issues or cached network settings.
If you use a Virtual Desktop Infrastructure (VDI) or virtual machine, then complete the following steps:
- Restart the VDI or virtual machine.
- Open the Lambda console.
- Check whether the Lambda function source code loads.
Collect diagnostic information
If you continue to experience issues after you followed the preceding troubleshooting steps, then collect diagnostic information to identify the root cause.
Generate HAR files
To capture detailed network traffic information that can help identify where connections fail, create an HTTP Archive (HAR) file.
Check browser console logs
Browser console logs show specific JavaScript errors or failed network requests that caused the Lambda console not to load the function source code.
Complete the following steps:
- Open the Lambda console.
- Select the Lambda function.
- Open your browser's developer tools.
- Review error messages or warnings that appear in the browser console logs.
- Take screenshots or note the error messages for further analysis.
Check the Health Dashboard
To determine whether a Lambda service disruption is temporarily causing the Lambda console not to load the function source code, check the AWS Health Dashboard.
Use alternative access methods
When you're troubleshooting console access issues, use the AWS CLI or CloudShell to view and manage Lambda function code.
Use the AWS CLI
Note: If you receive errors when you run AWS CLI commands, then see Troubleshooting errors for the AWS CLI. Also, make sure that you're using the most recent AWS CLI version.
To gain full access to the Lambda function source code and configuration, run the following get-function command:
aws lambda get-function --function-name your-function-name
Note: Replace your-function-name with the name of your Lambda function.
This output returns the function configuration and a pre-signed URL to download the deployment package.
Use CloudShell
Use CloudShell to manage Lambda functions from a preinstalled CLI.