error deploying to aws container from visual studio - amazon-web-services

I installed the visual studio aws tookit for vs, created a dotnet core app, deployed, and after a few tries deployed it and reached from browser.
Now I'm trying to deploy an updated version of the app and I have problems: after a few test I see that now the problem is the creation of the task that gives me the error (in the aws console)
CannotPullContainerError: failed to register layer: expected integer
What does it means? how can I fix it? After I saw the app running seems to me I didn't change anything in the configuration files.

Related

Amplify backend pull failed in web host app

We have set the CI/CD pipeline in amplify and since 22nd Dec the backend build is getting failed and throwing the error "Failed to pull the backend" as per the attached screenshot,
Expected behavior: The build should be successfully completed. Here I'm attaching the last successful build screenshot,
I tried to redeploy the last successful build, but that also failed and gave the same error.
version details,
Node.js: 16.18.1
Amplify CLI Version: 10.5.2
OS: Amazon Linux 2
NOTE: The project is working fine locally, and also the amplify pull command runs successfully. In local I'm using windows.
Thank you.

org.osgi.framework.BundleException: Could not resolve module: org.wso2.carbon.capp.monitor

I am using WSO2 Integration Studio 8.1.0 to develop an API on my machine, and when trying to run on Micro Integrator, I get the following error :
ERROR {Framework} - FrameworkEvent ERROR org.osgi.framework.BundleException: Could not resolve module: org.wso2.carbon.capp.monitor [170]
Unresolved requirement: Import-Package: org.wso2.carbon.application.deployer
at org.eclipse.osgi.container.Module.start(Module.java:457)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel$1.run(ModuleContainer.java:1820)
at org.eclipse.osgi.internal.framework.EquinoxContainerAdaptor$2$1.execute(EquinoxContainerAdaptor.java:150)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1813)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1770)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1735)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1661)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1)
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:234)
at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:345)
But after the error appears in the console the application runs fine.
Any ideas why I get this error and how to avoid it ?
This issue is happening due to a bug[1] in the Integration Studio. Due to this bug, the Studio was using the configuration of the older MI version to run/debug CApps. To fix this you will need to update the Integration Studio and manually remove some configurations as follows,
Remove the server configurations under ESB Mediation Debugger and Generic Server in Debug Configurations,
If the org.wso2.carbon.capp.monitor-3.0.0 jar is already present in IntegrationStudio/runtime/microesb/dropins folder remove it as well.
Restart the Integration Studio to load the new configurations shipped with the latest updates.
Please refer Get the latest updates to install the latest updates to Integration Studio.
[1] - https://github.com/wso2/api-manager/issues/772
The components of the MI product are activated as OSGI bundles at the kernel level during the server startup process. In this case, the OSGI bundle related to org.wso2.carbon.capp.monitor module is not activated because the org.wso2.carbon.application.deployer module is not available at the time when the OSGI bundle related to org.wso2.carbon.capp.monitor module is activated. As a result, the bundle activation issue will be visible during the initial server startup process.
However, once the bundle related to org.wso2.carbon.application.deployer is successfully activated, the OSGI bundle related to org.wso2.carbon.capp.monitor module will also be successfully re-activated, even if the bundling exception occurred during the initial bundle activation process.
We can check whether the OSGI bundle related to the org.wso2.carbon.capp.monitor module was successfully activated by looking for the org.wso2.carbon.capp.monitor-3.0.0.jar file in the <Integration_STUDIO_INSTALLED_LOCATION>/runtime/microesb/dropins directory after starting the MI server; additionally, the CAR application will not be deployed successfully if the OSGI bundle was not properly activated during the server startup process.
You can also validate it by redeploying the CAR application into the MI server. You will not notice the issue during the CAR application redeployment process because it occurs due to the order in the bundle activation process during the server startup.
This issue has been reported:
https://github.com/wso2/api-manager/issues/772
Please take the latest update by following the official guide:
https://apim.docs.wso2.com/en/latest/integrate/develop/installing-wso2-integration-studio/#get-the-latest-updates
Cheers!
Nadun.

ClassNotFoundException - when building the image & push it to GCR using jib-maven-plugin in BitBucket pipeline

I am getting the below error in my GCP Cloud Run service:
Error: Could not find or load main class com.sdas.demo.sd.Application
Caused by: java.lang.ClassNotFoundException: com.sdas.demo.sd.Application
What I was doing:
I have a spring boot application where I used jib-maven-plugin. In BitBucket pipeline, I was executing the below command:
mvn clean compile com.google.cloud.tools:jib-maven-plugin:3.1.4:build -Dimage=eu.gcr.io/sdas-demo-dev/temp-service
After that deploying this GCR image to Cloud Run using gcloud command from BitBucket pipeline. This deployment failed with the error that 'Could not load main class'.
But if I run the mvn clean compile com.google.cloud.tools:jib-maven-plugin:3.1.4:build -Dimage=eu.gcr.io/sdas-demo-dev/temp-service from my computer git bash for the same spring boot application code and then deploy it to Cloud Run (via gcloud command or via console or via pipeline); it's deployed successfully.
I used 'mainClass' tag under jib-maven-plugin in pom.xml. But still it is unable to find or load the main class.
Can anyone help how to identify the problem? Is this a classpath issue or environment issue?
Issue sorted now.
Root cause:
'No resources found to compile' - I found this message in the build log. This message remind me something wrong within the application package.
My system is running on Windows 10 and my application directory starting with 'Java.com.demo.sdas' (J in capital). Since Windows is case in sensitive; it is not causing an issue.
BitBucket pipeline running on Linux server and it is case sensitive. Thus it is unable to find the application directory starting with 'Java.com.demo.sdas'.
Solution: Renamed the directory as 'java' and then everything is working as expected.

AWS Beanstalk Platform .NET Core running on 64bit Amazon Linux 2/2.0.2 Publish Version Error

, I am trying to Publish my Elastic Beanstalka .NetCore Project Using Azure DevOps Pipeline, But Azure DevOps Pipeline also comes up to Beanstalk Publish without any problem in Restore, Build, Publish Steps, but I get the following error in AWS Beanstalka Log file.
Project .Net Core 2.2
In the Document of AWS: https://docs.amazonaws.cn/en_us/elasticbeanstalk/latest/platforms/platforms-supported.html#platforms-supported.dotnetlinux
[INFO] Executing instruction: RunAppDeployPreBuildHooks
[INFO] The dir .platform/hooks/prebuild/ does not exist in the application. Skipping this step...
[INFO] Executing instruction: CheckProcfileForDotNetCoreApplication
[INFO] checking application and updating executable file permissions...
[INFO] checking Procfile...
[ERROR] An error occurred during execution of command [app-deploy] - [CheckProcfileForDotNetCoreApplication]. Stop running the command. Error: there is no .runtimeconfig.json file for your single application. Please provide a valid application
I am having the same issue.
I don't know if this is the answer, as I am new to AWS, but I have found:
The instructions at https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/dotnet-core-tutorial.html only work if you create the Environment with a Windows server. It doesn't actually come right out and say that. It says:
For Platform, select the platform and platform branch that match the language used by your application.
But in the next section, it says:
IIS is the web server that runs the application on the Amazon EC2
instances in your Elastic Beanstalk environment.
And IIS only runs on Windows. So this implies the instructions are for Windows.
If you want to use Linux, just use the site.zip file these instructions have you create and upload that. You don't need the manifest file or the zip-within-zip. Just upload the site.zip.

Incompatible Windows docker image in AWS ECS

I have created a standard Windows cluster in AWS Elastic Container Services (ECS) and am trying to deploy an ASP.Net docker image (microsoft/aspnet:4.7.1-windowsservercore-1709) to it and get the following error
Status reason CannotPullContainerError: a Windows version
10.0.16299-based image is incompatible with a 10.0.14393 host
My application is a ASP.Net WebAPI application using .Net Framework 4.6.1.
My docker file is
FROM microsoft/aspnet:4.7.1-windowsservercore-1709
ARG source
WORKDIR /inetpub/wwwroot
COPY ${source:-obj/Docker/publish} .
Can anyone suggest what image I could deploy?
Thanks
Change your FROM to aspnet:4.7.1-windowsservercore-ltsc2016 and it should resolve your issue. Keep in mind the image size for this tag is considerably larger than 1709.
We also got the following message when using AWS ECS:
CannotPullContainerError: a Windows version 10.0.16299-based image is incompatible with a 10.0.14393 host
After a lot of trial and error we found that we were using .NetCore SDK 2.2 and AWS ECS wants 2.1. The developer made changes in Visual Studio 2017 and to the Dockerfile to reference 2.1 instead of 2.2. Once that was done ECS was able to consume it and we had a running state.
Unfortunately the error was not as descriptive and we went down the rabbit hole before discovering what really was our problem.