microsoft / azure-maven-plugins

Maven plugins for Azure
MIT License
272 stars 140 forks source link

azure-webapp-maven-plugin deploy fails with version >= 2.11.0 #2365

Closed ac-rdn closed 7 months ago

ac-rdn commented 10 months ago

Plugin name and version

azure-webapp-maven-plugin:2.11.0 azure-webapp-maven-plugin:2.11.1 azure-webapp-maven-plugin:2.12.0

Plugin configuration in your pom.xml

<configuration>
    <subscriptionId>${subscriptionId}</subscriptionId>
    <resourceGroup>${resourceGroup}</resourceGroup>
    <appName>${appName}</appName>
    <appSettings>
        <property>
            <name>JAVA_OPTS</name>
            <value>-javaagent:/home/site/wwwroot/applicationinsights-agent-${applicationinsights-agent.version}.jar</value>
        </property>
    </appSettings>
    <deployment>
        <resources>
            <resource>
                <type>jar</type>
                <directory>${project.build.directory}</directory>
                <includes>
                    <include>*.jar</include>
                </includes>
            </resource```
            <resource>
                <type>static</type>
                <directory>${project.build.directory}/agent</directory>
                <includes>
                    <include>*</include>
                </includes>
            </resource>
        </resources>
    </deployment>
    <auth>
        <type>service_principal</type>
        <serverId>${serverId}</serverId>
    </auth>
</configuration>

Expected behavior

The webapp is successfully deployed to Azure (cf. deploying with azure-webapp-maven-plugin:2.10.0).

Actual behavior

The webapp deploy to Azure fails with the following error (no configuration changes are made, except for the version of the azure-webapp-maven-plugin):

[INFO] --- azure-webapp-maven-plugin:2.12.0:deploy (default-cli) @ qap-service ---
[WARNING] default to NULL OperationContext, because operation or its action operation is null:null
[INFO] Use maven proxy: gateway.zscaler.net:9480
[INFO] Auth type: SERVICE_PRINCIPAL
[INFO] Username: 90eb...
[INFO] Subscription: ac-hybrid-production-01(0cbd...)
[INFO] Trying to deploy external resources to stg-qap-service...
[INFO] Successfully deployed the resources to stg-qap-service
[INFO] Trying to deploy artifact to stg-qap-service...
[INFO] Deploying (D:\Software\x64\Jenkins\workspace\Deploy_QAP_release_0.8.x\qap-service\target\qap-service-0.8.40-SNAPSHOT.jar)[jar]  ...
[WARNING] 'Content-Type' not found. Returning default encoding: JSON
[ERROR] Status code 403, (empty body)
[INFO] Opening streaming log of app(stg-qap-service)...
###############STREAMING LOG BEGIN##################
[WARNING] 'Content-Type' not found. Returning default encoding: JSON
[ERROR] Operator called default onErrorDropped
reactor.core.Exceptions$ErrorCallbackNotImplemented: com.azure.core.exception.HttpResponseException: Status code 403, (empty body)
Caused by: com.azure.core.exception.HttpResponseException: Status code 403, (empty body)
    at com.azure.core.implementation.http.rest.RestProxyBase.instantiateUnexpectedException (RestProxyBase.java:337)
    at com.azure.core.implementation.http.rest.AsyncRestProxy.lambda$ensureExpectedStatus$1 (AsyncRestProxy.java:123)
    at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.onNext (FluxMapFuseable.java:113)
    at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.onNext (FluxMapFuseable.java:129)
    at reactor.core.publisher.Operators$BaseFluxToMonoOperator.completePossiblyEmpty (Operators.java:2071)
    at reactor.core.publisher.MonoCollect$CollectSubscriber.onComplete (MonoCollect.java:145)
    at reactor.core.publisher.FluxMap$MapSubscriber.onComplete (FluxMap.java:144)
    at reactor.core.publisher.MonoFlatMapMany$FlatMapManyInner.onComplete (MonoFlatMapMany.java:260)
    at reactor.core.publisher.Operators.complete (Operators.java:137)
    at reactor.core.publisher.FluxIterable.subscribe (FluxIterable.java:144)
    at reactor.core.publisher.FluxIterable.subscribe (FluxIterable.java:83)
    at reactor.core.publisher.Flux.subscribe (Flux.java:8671)
    at reactor.core.publisher.MonoFlatMapMany$FlatMapManyMain.onNext (MonoFlatMapMany.java:195)
    at reactor.core.publisher.Operators$MonoSubscriber.complete (Operators.java:1839)
    at reactor.core.publisher.MonoCacheTime.subscribeOrReturn (MonoCacheTime.java:151)
    at reactor.core.publisher.InternalMonoOperator.subscribe (InternalMonoOperator.java:57)
    at reactor.core.publisher.MonoFlatMap$FlatMapMain.onNext (MonoFlatMap.java:165)
    at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.onNext (FluxMapFuseable.java:129)
    at reactor.core.publisher.FluxHide$SuppressFuseableSubscriber.onNext (FluxHide.java:137)
    at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.onNext (FluxMapFuseable.java:129)
    at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.onNext (FluxMapFuseable.java:129)
    at reactor.core.publisher.FluxHide$SuppressFuseableSubscriber.onNext (FluxHide.java:137)
    at reactor.core.publisher.FluxMap$MapSubscriber.onNext (FluxMap.java:122)
    at reactor.core.publisher.FluxOnErrorResume$ResumeSubscriber.onNext (FluxOnErrorResume.java:79)
    at reactor.core.publisher.MonoFlatMap$FlatMapMain.onNext (MonoFlatMap.java:158)
    at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.onNext (FluxMapFuseable.java:129)
    at reactor.core.publisher.MonoFlatMap$FlatMapMain.onNext (MonoFlatMap.java:158)
    at reactor.core.publisher.MonoIgnoreThen$ThenIgnoreMain.complete (MonoIgnoreThen.java:292)
    at reactor.core.publisher.MonoIgnoreThen$ThenIgnoreMain.onNext (MonoIgnoreThen.java:187)
    at reactor.core.publisher.MonoFlatMap$FlatMapMain.secondComplete (MonoFlatMap.java:245)
    at reactor.core.publisher.MonoFlatMap$FlatMapInner.onNext (MonoFlatMap.java:305)
    at reactor.core.publisher.MonoFlatMap$FlatMapMain.onNext (MonoFlatMap.java:158)
    at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.onNext (FluxMapFuseable.java:129)
    at reactor.core.publisher.Operators$BaseFluxToMonoOperator.completePossiblyEmpty (Operators.java:2071)
    at reactor.core.publisher.MonoCollect$CollectSubscriber.onComplete (MonoCollect.java:145)
    at reactor.core.publisher.FluxMap$MapSubscriber.onComplete (FluxMap.java:144)
    at reactor.core.publisher.MonoFlatMapMany$FlatMapManyInner.onComplete (MonoFlatMapMany.java:260)
    at reactor.core.publisher.Operators.complete (Operators.java:137)
    at reactor.core.publisher.FluxIterable.subscribe (FluxIterable.java:144)
    at reactor.core.publisher.FluxIterable.subscribe (FluxIterable.java:83)
    at reactor.core.publisher.Flux.subscribe (Flux.java:8671)
    at reactor.core.publisher.MonoFlatMapMany$FlatMapManyMain.onNext (MonoFlatMapMany.java:195)
    at reactor.core.publisher.Operators$MonoSubscriber.complete (Operators.java:1839)
    at reactor.core.publisher.MonoCacheTime$CoordinatorSubscriber.signalCached (MonoCacheTime.java:337)
    at reactor.core.publisher.MonoCacheTime$CoordinatorSubscriber.onNext (MonoCacheTime.java:354)
    at reactor.core.publisher.Operators$BaseFluxToMonoOperator.completePossiblyEmpty (Operators.java:2071)
    at reactor.core.publisher.MonoCollectList$MonoCollectListSubscriber.onComplete (MonoCollectList.java:118)
    at reactor.core.publisher.FluxMap$MapSubscriber.onComplete (FluxMap.java:144)
    at reactor.core.publisher.FluxDoFinally$DoFinallySubscriber.onComplete (FluxDoFinally.java:128)
    at reactor.core.publisher.FluxMap$MapSubscriber.onComplete (FluxMap.java:144)
    at reactor.core.publisher.FluxMap$MapSubscriber.onComplete (FluxMap.java:144)
    at reactor.netty.channel.FluxReceive.onInboundComplete (FluxReceive.java:415)
    at reactor.netty.channel.ChannelOperations.onInboundComplete (ChannelOperations.java:424)
    at reactor.netty.channel.ChannelOperations.terminate (ChannelOperations.java:478)
    at reactor.netty.http.client.HttpClientOperations.onInboundNext (HttpClientOperations.java:712)
    at reactor.netty.channel.ChannelOperationsHandler.channelRead (ChannelOperationsHandler.java:113)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead (AbstractChannelHandlerContext.java:444)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead (AbstractChannelHandlerContext.java:420)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead (AbstractChannelHandlerContext.java:412)
    at io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead (CombinedChannelDuplexHandler.java:436)
    at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead (ByteToMessageDecoder.java:346)
    at io.netty.handler.codec.ByteToMessageDecoder.channelRead (ByteToMessageDecoder.java:318)
    at io.netty.channel.CombinedChannelDuplexHandler.channelRead (CombinedChannelDuplexHandler.java:251)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead (AbstractChannelHandlerContext.java:442)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead (AbstractChannelHandlerContext.java:420)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead (AbstractChannelHandlerContext.java:412)
    at io.netty.handler.ssl.SslHandler.unwrap (SslHandler.java:1382)
    at io.netty.handler.ssl.SslHandler.decodeNonJdkCompatible (SslHandler.java:1256)
    at io.netty.handler.ssl.SslHandler.decode (SslHandler.java:1296)
    at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection (ByteToMessageDecoder.java:529)
    at io.netty.handler.codec.ByteToMessageDecoder.callDecode (ByteToMessageDecoder.java:468)
    at io.netty.handler.codec.ByteToMessageDecoder.channelRead (ByteToMessageDecoder.java:290)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead (AbstractChannelHandlerContext.java:444)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead (AbstractChannelHandlerContext.java:420)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead (AbstractChannelHandlerContext.java:412)
    at io.netty.handler.proxy.ProxyHandler.channelRead (ProxyHandler.java:252)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead (AbstractChannelHandlerContext.java:442)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead (AbstractChannelHandlerContext.java:420)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead (AbstractChannelHandlerContext.java:412)
    at io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead (CombinedChannelDuplexHandler.java:436)
    at io.netty.channel.CombinedChannelDuplexHandler.channelRead (CombinedChannelDuplexHandler.java:253)
    at io.netty.handler.proxy.HttpProxyHandler$HttpClientCodecWrapper.channelRead (HttpProxyHandler.java:272)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead (AbstractChannelHandlerContext.java:444)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead (AbstractChannelHandlerContext.java:420)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead (AbstractChannelHandlerContext.java:412)
    at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead (DefaultChannelPipeline.java:1410)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead (AbstractChannelHandlerContext.java:440)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead (AbstractChannelHandlerContext.java:420)
    at io.netty.channel.DefaultChannelPipeline.fireChannelRead (DefaultChannelPipeline.java:919)
    at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read (AbstractNioByteChannel.java:166)
    at io.netty.channel.nio.NioEventLoop.processSelectedKey (NioEventLoop.java:788)
    at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized (NioEventLoop.java:724)
    at io.netty.channel.nio.NioEventLoop.processSelectedKeys (NioEventLoop.java:650)
    at io.netty.channel.nio.NioEventLoop.run (NioEventLoop.java:562)
    at io.netty.util.concurrent.SingleThreadEventExecutor$4.run (SingleThreadEventExecutor.java:997)
    at io.netty.util.internal.ThreadExecutorMap$2.run (ThreadExecutorMap.java:74)
    at io.netty.util.concurrent.FastThreadLocalRunnable.run (FastThreadLocalRunnable.java:30)
    at java.lang.Thread.run (Thread.java:833)
###############STREAMING LOG END##################
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 07:06 min
[INFO] Finished at: 2023-09-04T10:09:49+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.microsoft.azure:azure-webapp-maven-plugin:2.12.0:deploy (default-cli) on project qap-service: deploy to Azure Web App with resource creation or updating: AzureToolkitRuntimeException: deploy to Azure Web App(stg-qap-service) with resource creation or updating: Status code 403, (empty body) -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

Steps to reproduce the problem

Run mvn clean package azure-webapp:deploy -PcopyApplicationInsightsAgent,${chosenEnvironment} --projects qap-service

Flanker32 commented 8 months ago

@ac-rdn Thanks for your report and really sorry for the late response. Could this issue be reproduced now? I tried to deploy a spring app with maven plugin 2.11.0 and it works fine. If the issue persists, could you please share us a demo project and the runtime settings to help us better investigate this issue? Thanks again for your help.

ac-rdn commented 7 months ago

@Flanker32 In the last 2 weeks I was able to do some tests and successfully deploy several app services with azure-webapp-maven-plugin:2.12.0 on different days. So it seems this issue disappeared automagically 🪄