aws / serverless-java-container

A Java wrapper to run Spring, Spring Boot, Jersey, and other apps inside AWS Lambda.
https://aws.amazon.com/serverless/
Apache License 2.0
1.5k stars 560 forks source link

Issue integrating with Azure AD #454

Open karpagamvijayan opened 2 years ago

karpagamvijayan commented 2 years ago

To help us debug your issue fill in the basic information below using the options provided

Serverless Java Container version: 1.6

Implementations: Spring Boot 2

Framework version: SpringBoot 2.6.3.RELEASE

Frontend service: REST API

Deployment method: Deployed on Lambda exposed using API Gateway (REST API)

Scenario

After integrating the lambda handler with my application , it works fine but when i try to add one more security configuration for Azure AD using AADResourceServerWebSecurityConfigurerAdapter from library azure-spring-boot-starter-active-directory , I get the following error: Null Pointer Exception - when no content ttype is set or pathPatternParserServerWebExchangeMatcher : Request 'GET /auth/v1/healthCheck' doesn't match 'GET /login - when content type is set

Expected behavior

200

Actual behavior

504-Gateway timeout with error as listed above

Steps to reproduce

@Configuration
@Order(1)
public class SecurityConfigDB extends WebSecurityConfigurerAdapter {

    @Override
    protected void configure(HttpSecurity http) throws Exception {

        http.cors().configurationSource(corsConfigurationSource());
        http.csrf().disable();

        http.antMatcher("/api/**").csrf().disable()
                .exceptionHandling()
                    .authenticationEntryPoint(authenticationEntryPoint)
                    .accessDeniedHandler(accessDeniedHandler)
                .and()
                .sessionManagement()
                .sessionCreationPolicy(SessionCreationPolicy.STATELESS)
                .and()
                .authorizeRequests()
                .antMatchers(AUTH_WHITELIST).permitAll()
                .anyRequest()
                .authenticated()
                 ;       

        http.addFilterBefore(jwtAuthenticationFilter(), UsernamePasswordAuthenticationFilter.class);
    }

    @Override
    protected void configure(AuthenticationManagerBuilder auth) throws Exception {

        auth.authenticationProvider(dbAuthenticationProvider);

    }

    @Override
    @Bean
    public AuthenticationManager authenticationManagerBean() throws Exception {
        return super.authenticationManagerBean();
    }
}

@Configuration
@Order(2)
public class AADSecurityConfig extends AADResourceServerWebSecurityConfigurerAdapter {

    @Override
    protected void configure(HttpSecurity http) throws Exception {
        super.configure(http);
        http.cors().configurationSource(corsConfigurationSource());

        http
        .authorizeRequests()
        .antMatchers(AUTH_WHITELIST).permitAll().and()
        .antMatcher("/oauth/**")
        .authorizeRequests((requests) -> requests.anyRequest().authenticated())
        .csrf().disable()
        .exceptionHandling()
            .authenticationEntryPoint(authenticationEntryPoint)
            .accessDeniedHandler(accessDeniedHandler)
        .and()
        .sessionManagement()
        .sessionCreationPolicy(SessionCreationPolicy.STATELESS)

        ;   
    }

}

Full log output

2022-03-30 08:22:22.911 INFO --- [ main] c.a.s.p.internal.LambdaContainerHandler : Starting Lambda Container Handler 2022-03-30 08:22:23.202 INFO --- [ main] c.a.s.proxy.AsyncInitializationWrapper : Async initialization will wait for 8290ms 2022-03-30 08:22:23.203 INFO --- [ Thread-0] c.a.s.proxy.AsyncInitializationWrapper : Starting async initializer . _ _ /\ / '_ () \ \ \ \ ( ( )\ | ' | '| | ' \/ ` | \ \ \ \ \/ _)| |)| | | | | || (| | ) ) ) ) ' |__| ._|| ||| |_, | / / / / =========|_|==============|__/=//// :: Spring Boot :: (v2.6.3) 2022-03-30 08:22:29.647 INFO 9 --- [ Thread-0] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [name: default] 2022-03-30 08:22:29.744 INFO 9 --- [ Thread-0] org.hibernate.Version : HHH000412: Hibernate ORM core version 5.6.4.Final 2022-03-30 08:22:30.067 INFO 9 --- [ Thread-0] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.1.2.Final} START RequestId: 356e429e-cecf-4ccf-a3a8-1ecdd819a941 Version: $LATEST 2022-03-30 08:22:30.243 INFO 9 --- [ Thread-0] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting... 2022-03-30 08:22:30.591 INFO 9 --- [ Thread-0] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed. 2022-03-30 08:22:30.612 INFO 9 --- [ Thread-0] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.MySQL5InnoDBDialect 2022-03-30 08:22:31.493 INFO 9 --- [ main] c.a.s.proxy.AsyncInitializationWrapper : Initialization took longer than 10000, setting new CountDownLatch and continuing in event handler 2022-03-30 08:22:32.521 INFO 9 --- [ Thread-0] o.h.e.t.j.p.i.JtaPlatformInitiator : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform] 2022-03-30 08:22:44.813 DEBUG 9 --- [ Thread-0] edFilterInvocationSecurityMetadataSource : Adding web access control expression [permitAll] for Ant [pattern='/v2/api-docs'] 2022-03-30 08:22:44.848 DEBUG 9 --- [ Thread-0] edFilterInvocationSecurityMetadataSource : Adding web access control expression [permitAll] for Ant [pattern='/swagger-resources'] 2022-03-30 08:22:44.849 DEBUG 9 --- [ Thread-0] edFilterInvocationSecurityMetadataSource : Adding web access control expression [permitAll] for Ant [pattern='/swagger-resources/'] 2022-03-30 08:22:44.849 DEBUG 9 --- [ Thread-0] edFilterInvocationSecurityMetadataSource : Adding web access control expression [permitAll] for Ant [pattern='/configuration/ui'] 2022-03-30 08:22:44.849 DEBUG 9 --- [ Thread-0] edFilterInvocationSecurityMetadataSource : Adding web access control expression [permitAll] for Ant [pattern='/configuration/security'] 2022-03-30 08:22:44.849 DEBUG 9 --- [ Thread-0] edFilterInvocationSecurityMetadataSource : Adding web access control expression [permitAll] for Ant [pattern='/swagger-ui.html'] 2022-03-30 08:22:44.849 DEBUG 9 --- [ Thread-0] edFilterInvocationSecurityMetadataSource : Adding web access control expression [permitAll] for Ant [pattern='/webjars/'] 2022-03-30 08:22:44.849 DEBUG 9 --- [ Thread-0] edFilterInvocationSecurityMetadataSource : Adding web access control expression [permitAll] for Ant [pattern='/v3/api-docs/'] 2022-03-30 08:22:44.850 DEBUG 9 --- [ Thread-0] edFilterInvocationSecurityMetadataSource : Adding web access control expression [permitAll] for Ant [pattern='/swagger-ui/'] 2022-03-30 08:22:44.850 DEBUG 9 --- [ Thread-0] edFilterInvocationSecurityMetadataSource : Adding web access control expression [permitAll] for Ant [pattern='/oauth'] 2022-03-30 08:22:44.850 DEBUG 9 --- [ Thread-0] edFilterInvocationSecurityMetadataSource : Adding web access control expression [permitAll] for Ant [pattern='/oauth/'] 2022-03-30 08:22:44.850 DEBUG 9 --- [ Thread-0] edFilterInvocationSecurityMetadataSource : Adding web access control expression [permitAll] for Ant [pattern='/auth/v1/'] 2022-03-30 08:22:44.850 DEBUG 9 --- [ Thread-0] edFilterInvocationSecurityMetadataSource : Adding web access control expression [authenticated] for any request 2022-03-30 08:22:44.947 INFO 9 --- [ Thread-0] o.s.s.web.DefaultSecurityFilterChain : Will secure Ant [pattern='/oauth/*'] with [org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter@71959ece, org.springframework.security.web.context.SecurityContextPersistenceFilter@189ad29e, org.springframework.security.web.header.HeaderWriterFilter@3a3b8008, org.springframework.web.filter.CorsFilter@74d2643e, org.springframework.security.web.authentication.logout.LogoutFilter@fa7b4f4, org.springframework.security.oauth2.server.resource.web.BearerTokenAuthenticationFilter@cdddbf, org.springframework.security.web.savedrequest.RequestCacheAwareFilter@6270c0ca, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter@6f6f5431, org.springframework.security.web.authentication.AnonymousAuthenticationFilter@5f26801c, org.springframework.security.web.session.SessionManagementFilter@39013c12, org.springframework.security.web.access.ExceptionTranslationFilter@3e3a59bb, org.springframework.security.web.access.intercept.FilterSecurityInterceptor@2412c67e] 2022-03-30 08:22:50.755 DEBUG 9 --- [ main] o.s.s.w.s.u.m.OrServerWebExchangeMatcher : Trying to match using PathMatcherServerWebExchangeMatcher{pattern='/login', method=POST} 2022-03-30 08:22:50.757 DEBUG 9 --- [ main] athPatternParserServerWebExchangeMatcher : Request 'GET /auth/v1/healthCheck' doesn't match 'POST /login' 2022-03-30 08:22:50.757 DEBUG 9 --- [ main] o.s.s.w.s.u.m.OrServerWebExchangeMatcher : No matches found 2022-03-30 08:22:50.758 DEBUG 9 --- [ main] o.s.s.w.s.u.m.OrServerWebExchangeMatcher : Trying to match using PathMatcherServerWebExchangeMatcher{pattern='/login', method=GET} 2022-03-30 08:22:50.758 DEBUG 9 --- [ main] athPatternParserServerWebExchangeMatcher : Request 'GET /auth/v1/healthCheck' doesn't match 'GET /login' 2022-03-30 08:22:50.767 DEBUG 9 --- [ main] o.s.s.w.s.u.m.OrServerWebExchangeMatcher : No matches found 2022-03-30 08:22:50.768 DEBUG 9 --- [ main] o.s.s.w.s.u.m.OrServerWebExchangeMatcher : Trying to match using PathMatcherServerWebExchangeMatcher{pattern='/logout', method=GET} 2022-03-30 08:22:50.769 DEBUG 9 --- [ main] athPatternParserServerWebExchangeMatcher : Request 'GET /auth/v1/healthCheck' doesn't match 'GET /logout' 2022-03-30 08:22:50.769 DEBUG 9 --- [ main] o.s.s.w.s.u.m.OrServerWebExchangeMatcher : No matches found 2022-03-30 08:22:50.907 DEBUG 9 --- [ parallel-1] o.s.s.w.s.u.m.OrServerWebExchangeMatcher : Trying to match using PathMatcherServerWebExchangeMatcher{pattern='/logout', method=POST} 2022-03-30 08:22:50.907 DEBUG 9 --- [ parallel-1] athPatternParserServerWebExchangeMatcher : Request 'GET /auth/v1/healthCheck' doesn't match 'POST /logout' 2022-03-30 08:22:50.907 DEBUG 9 --- [ parallel-1] o.s.s.w.s.u.m.OrServerWebExchangeMatcher : No matches found 2022-03-30 08:22:50.914 DEBUG 9 --- [ parallel-1] a.DelegatingReactiveAuthorizationManager : Checking authorization on '/auth/v1/healthCheck' using org.springframework.security.authorization.AuthenticatedReactiveAuthorizationManager@18d1b8a2 2022-03-30 08:22:50.917 DEBUG 9 --- [ parallel-1] ebSessionServerSecurityContextRepository : No SecurityContext found in WebSession: 'org.springframework.web.server.session.InMemoryWebSessionStore$InMemoryWebSession@6ab17b89' 2022-03-30 08:22:50.918 DEBUG 9 --- [ parallel-1] o.s.s.w.s.a.AuthorizationWebFilter : Authorization failed: Access Denied 2022-03-30 08:22:50.992 DEBUG 9 --- [ parallel-1] ebSessionServerSecurityContextRepository : No SecurityContext found in WebSession: 'org.springframework.web.server.session.InMemoryWebSessionStore$InMemoryWebSession@6ab17b89' 2022-03-30 08:22:50.993 DEBUG 9 --- [ parallel-1] DelegatingServerAuthenticationEntryPoint : Trying to match using MediaTypeRequestMatcher [matchingMediaTypes=[text/html], useEquals=false, ignoredMediaTypes=[/]] 2022-03-30 08:22:50.993 DEBUG 9 --- [ parallel-1] .s.u.m.MediaTypeServerWebExchangeMatcher : httpRequestMediaTypes=[] 2022-03-30 08:22:50.994 DEBUG 9 --- [ parallel-1] .s.u.m.MediaTypeServerWebExchangeMatcher : Did not match any media types 2022-03-30 08:22:50.994 DEBUG 9 --- [ parallel-1] DelegatingServerAuthenticationEntryPoint : Trying to match using OrServerWebExchangeMatcher{matchers=[org.springframework.security.config.web.server.ServerHttpSecurity$HttpBasicSpec$$Lambda$981/717428152@74bb7021, AndServerWebExchangeMatcher{matchers=[NegatedServerWebExchangeMatcher{matcher=MediaTypeRequestMatcher [matchingMediaTypes=[text/html], useEquals=false, ignoredMediaTypes=[]]}, MediaTypeRequestMatcher [matchingMediaTypes=[application/atom+xml, application/x-www-form-urlencoded, application/json, application/octet-stream, application/xml, multipart/form-data, text/xml], useEquals=false, ignoredMediaTypes=[/]]]}]} 2022-03-30 08:22:50.995 DEBUG 9 --- [ parallel-1] o.s.s.w.s.u.m.OrServerWebExchangeMatcher : Trying to match using org.springframework.security.config.web.server.ServerHttpSecurity$HttpBasicSpec$$Lambda$981/717428152@74bb7021 2022-03-30 08:22:50.996 DEBUG 9 --- [ parallel-1] o.s.s.w.s.u.m.OrServerWebExchangeMatcher : Trying to match using AndServerWebExchangeMatcher{matchers=[NegatedServerWebExchangeMatcher{matcher=MediaTypeRequestMatcher [matchingMediaTypes=[text/html], useEquals=false, ignoredMediaTypes=[]]}, MediaTypeRequestMatcher [matchingMediaTypes=[application/atom+xml, application/x-www-form-urlencoded, application/json, application/octet-stream, application/xml, multipart/form-data, text/xml], useEquals=false, ignoredMediaTypes=[/]]]} 2022-03-30 08:22:51.007 DEBUG 9 --- [ parallel-1] .s.s.w.s.u.m.AndServerWebExchangeMatcher : Trying to match using NegatedServerWebExchangeMatcher{matcher=MediaTypeRequestMatcher [matchingMediaTypes=[text/html], useEquals=false, ignoredMediaTypes=[]]} 2022-03-30 08:22:51.008 DEBUG 9 --- [ parallel-1] .s.u.m.MediaTypeServerWebExchangeMatcher : httpRequestMediaTypes=[] 2022-03-30 08:22:51.008 DEBUG 9 --- [ parallel-1] .s.u.m.MediaTypeServerWebExchangeMatcher : Did not match any media types 2022-03-30 08:22:51.009 DEBUG 9 --- [ parallel-1] .w.s.u.m.NegatedServerWebExchangeMatcher : matches = true 2022-03-30 08:22:51.009 DEBUG 9 --- [ parallel-1] .s.s.w.s.u.m.AndServerWebExchangeMatcher : Trying to match using MediaTypeRequestMatcher [matchingMediaTypes=[application/atom+xml, application/x-www-form-urlencoded, application/json, application/octet-stream, application/xml, multipart/form-data, text/xml], useEquals=false, ignoredMediaTypes=[/*]] 2022-03-30 08:22:51.010 DEBUG 9 --- [ parallel-1] .s.u.m.MediaTypeServerWebExchangeMatcher : httpRequestMediaTypes=[] 2022-03-30 08:22:51.010 DEBUG 9 --- [ parallel-1] .s.u.m.MediaTypeServerWebExchangeMatcher : Did not match any media types 2022-03-30 08:22:51.010 DEBUG 9 --- [ parallel-1] .s.s.w.s.u.m.AndServerWebExchangeMatcher : Did not match 2022-03-30 08:22:51.010 DEBUG 9 --- [ parallel-1] o.s.s.w.s.u.m.OrServerWebExchangeMatcher : No matches found 2022-03-30 08:22:51.010 DEBUG 9 --- [ parallel-1] DelegatingServerAuthenticationEntryPoint : No match found. Using default entry point org.springframework.security.web.server.DelegatingServerAuthenticationEntryPoint@273bf697 2022-03-30 08:22:51.010 DEBUG 9 --- [ parallel-1] DelegatingServerAuthenticationEntryPoint : Trying to match using org.springframework.security.config.web.server.ServerHttpSecurity$HttpBasicSpec$$Lambda$981/717428152@74bb7021 2022-03-30 08:22:51.011 DEBUG 9 --- [ parallel-1] DelegatingServerAuthenticationEntryPoint : No match found. Using default entry point org.springframework.security.web.server.authentication.HttpBasicServerAuthenticationEntryPoint@3ac69616 2022-03-30 08:22:51.050 INFO 9 --- [ main] c.a.s.p.internal.LambdaContainerHandler : test-invoke-source-ip arn:aws:sts::#########:assumed-role/#########arn:aws:sts::#########:assumed-role/######### arn:aws:sts::#########:assumed-role/######### [30/03/2022:08:22:21Z] "GET /auth/v1/healthCheck HTTP/1.1" 401 - "####" "aws-internal/3 aws-sdk-java/1.12.162 Linux/5.4.176-103.347.amzn2int.x86_64 OpenJDK_64-Bit_Server_VM/25.322-b06 java/1.8.0_322 vendor/Oracle_Corporation cfg/retry-mode/standard" combined END RequestId: 356e429e-cecf-4ccf-a3a8-1ecdd819a941 REPORT RequestId: 356e429e-cecf-4ccf-a3a8-1ecdd819a941 Duration: 19565.99 ms Billed Duration: 19566 ms Memory Size: 1024 MB Max Memory Used: 354 MB Init Duration: 9923.44 ms

With Content-Type Error: START RequestId: 7936b777-82e6-4a54-bda8-04f4a36f52db Version: $LATEST 2022-03-30 08:24:03.587 DEBUG 9 --- [ main] o.s.s.w.s.u.m.OrServerWebExchangeMatcher : Trying to match using PathMatcherServerWebExchangeMatcher{pattern='/login', method=POST} 2022-03-30 08:24:03.587 DEBUG 9 --- [ main] athPatternParserServerWebExchangeMatcher : Request 'GET /auth/v1/healthCheck' doesn't match 'POST /login' 2022-03-30 08:24:03.588 DEBUG 9 --- [ main] o.s.s.w.s.u.m.OrServerWebExchangeMatcher : No matches found 2022-03-30 08:24:03.588 DEBUG 9 --- [ main] o.s.s.w.s.u.m.OrServerWebExchangeMatcher : Trying to match using PathMatcherServerWebExchangeMatcher{pattern='/login', method=GET} 2022-03-30 08:24:03.588 DEBUG 9 --- [ main] athPatternParserServerWebExchangeMatcher : Request 'GET /auth/v1/healthCheck' doesn't match 'GET /login' 2022-03-30 08:24:03.588 DEBUG 9 --- [ main] o.s.s.w.s.u.m.OrServerWebExchangeMatcher : No matches found 2022-03-30 08:24:03.588 DEBUG 9 --- [ main] o.s.s.w.s.u.m.OrServerWebExchangeMatcher : Trying to match using PathMatcherServerWebExchangeMatcher{pattern='/logout', method=GET} 2022-03-30 08:24:03.589 DEBUG 9 --- [ main] athPatternParserServerWebExchangeMatcher : Request 'GET /auth/v1/healthCheck' doesn't match 'GET /logout' 2022-03-30 08:24:03.589 DEBUG 9 --- [ main] o.s.s.w.s.u.m.OrServerWebExchangeMatcher : No matches found 2022-03-30 08:24:03.590 DEBUG 9 --- [ parallel-2] o.s.s.w.s.u.m.OrServerWebExchangeMatcher : Trying to match using PathMatcherServerWebExchangeMatcher{pattern='/logout', method=POST} 2022-03-30 08:24:03.590 DEBUG 9 --- [ parallel-2] athPatternParserServerWebExchangeMatcher : Request 'GET /auth/v1/healthCheck' doesn't match 'POST /logout' 2022-03-30 08:24:03.590 DEBUG 9 --- [ parallel-2] o.s.s.w.s.u.m.OrServerWebExchangeMatcher : No matches found 2022-03-30 08:24:03.591 DEBUG 9 --- [ parallel-2] a.DelegatingReactiveAuthorizationManager : Checking authorization on '/auth/v1/healthCheck' using org.springframework.security.authorization.AuthenticatedReactiveAuthorizationManager@18d1b8a2 2022-03-30 08:24:03.591 DEBUG 9 --- [ parallel-2] ebSessionServerSecurityContextRepository : No SecurityContext found in WebSession: 'org.springframework.web.server.session.InMemoryWebSessionStore$InMemoryWebSession@69bb3445' 2022-03-30 08:24:03.591 DEBUG 9 --- [ parallel-2] o.s.s.w.s.a.AuthorizationWebFilter : Authorization failed: Access Denied 2022-03-30 08:24:03.592 DEBUG 9 --- [ parallel-2] ebSessionServerSecurityContextRepository : No SecurityContext found in WebSession: 'org.springframework.web.server.session.InMemoryWebSessionStore$InMemoryWebSession@69bb3445' 2022-03-30 08:24:03.592 DEBUG 9 --- [ parallel-2] DelegatingServerAuthenticationEntryPoint : Trying to match using MediaTypeRequestMatcher [matchingMediaTypes=[text/html], useEquals=false, ignoredMediaTypes=[/]] 2022-03-30 08:24:03.592 DEBUG 9 --- [ parallel-2] .s.u.m.MediaTypeServerWebExchangeMatcher : httpRequestMediaTypes=[] 2022-03-30 08:24:03.592 DEBUG 9 --- [ parallel-2] .s.u.m.MediaTypeServerWebExchangeMatcher : Did not match any media types 2022-03-30 08:24:03.592 DEBUG 9 --- [ parallel-2] DelegatingServerAuthenticationEntryPoint : Trying to match using OrServerWebExchangeMatcher{matchers=[org.springframework.security.config.web.server.ServerHttpSecurity$HttpBasicSpec$$Lambda$981/717428152@74bb7021, AndServerWebExchangeMatcher{matchers=[NegatedServerWebExchangeMatcher{matcher=MediaTypeRequestMatcher [matchingMediaTypes=[text/html], useEquals=false, ignoredMediaTypes=[]]}, MediaTypeRequestMatcher [matchingMediaTypes=[application/atom+xml, application/x-www-form-urlencoded, application/json, application/octet-stream, application/xml, multipart/form-data, text/xml], useEquals=false, ignoredMediaTypes=[/]]]}]} 2022-03-30 08:24:03.593 DEBUG 9 --- [ parallel-2] o.s.s.w.s.u.m.OrServerWebExchangeMatcher : Trying to match using org.springframework.security.config.web.server.ServerHttpSecurity$HttpBasicSpec$$Lambda$981/717428152@74bb7021 2022-03-30 08:24:03.593 DEBUG 9 --- [ parallel-2] o.s.s.w.s.u.m.OrServerWebExchangeMatcher : Trying to match using AndServerWebExchangeMatcher{matchers=[NegatedServerWebExchangeMatcher{matcher=MediaTypeRequestMatcher [matchingMediaTypes=[text/html], useEquals=false, ignoredMediaTypes=[]]}, MediaTypeRequestMatcher [matchingMediaTypes=[application/atom+xml, application/x-www-form-urlencoded, application/json, application/octet-stream, application/xml, multipart/form-data, text/xml], useEquals=false, ignoredMediaTypes=[/]]]} 2022-03-30 08:24:03.593 DEBUG 9 --- [ parallel-2] .s.s.w.s.u.m.AndServerWebExchangeMatcher : Trying to match using NegatedServerWebExchangeMatcher{matcher=MediaTypeRequestMatcher [matchingMediaTypes=[text/html], useEquals=false, ignoredMediaTypes=[]]} 2022-03-30 08:24:03.593 DEBUG 9 --- [ parallel-2] .s.u.m.MediaTypeServerWebExchangeMatcher : httpRequestMediaTypes=[] 2022-03-30 08:24:03.593 DEBUG 9 --- [ parallel-2] .s.u.m.MediaTypeServerWebExchangeMatcher : Did not match any media types 2022-03-30 08:24:03.593 DEBUG 9 --- [ parallel-2] .w.s.u.m.NegatedServerWebExchangeMatcher : matches = true 2022-03-30 08:24:03.594 DEBUG 9 --- [ parallel-2] .s.s.w.s.u.m.AndServerWebExchangeMatcher : Trying to match using MediaTypeRequestMatcher [matchingMediaTypes=[application/atom+xml, application/x-www-form-urlencoded, application/json, application/octet-stream, application/xml, multipart/form-data, text/xml], useEquals=false, ignoredMediaTypes=[/]] 2022-03-30 08:24:03.594 DEBUG 9 --- [ parallel-2] .s.u.m.MediaTypeServerWebExchangeMatcher : httpRequestMediaTypes=[] 2022-03-30 08:24:03.594 DEBUG 9 --- [ parallel-2] .s.u.m.MediaTypeServerWebExchangeMatcher : Did not match any media types 2022-03-30 08:24:03.594 DEBUG 9 --- [ parallel-2] .s.s.w.s.u.m.AndServerWebExchangeMatcher : Did not match 2022-03-30 08:24:03.594 DEBUG 9 --- [ parallel-2] o.s.s.w.s.u.m.OrServerWebExchangeMatcher : No matches found 2022-03-30 08:24:03.594 DEBUG 9 --- [ parallel-2] DelegatingServerAuthenticationEntryPoint : No match found. Using default entry point org.springframework.security.web.server.DelegatingServerAuthenticationEntryPoint@273bf697 2022-03-30 08:24:03.594 DEBUG 9 --- [ parallel-2] DelegatingServerAuthenticationEntryPoint : Trying to match using org.springframework.security.config.web.server.ServerHttpSecurity$HttpBasicSpec$$Lambda$981/717428152@74bb7021 2022-03-30 08:24:03.595 DEBUG 9 --- [ parallel-2] DelegatingServerAuthenticationEntryPoint : No match found. Using default entry point org.springframework.security.web.server.authentication.HttpBasicServerAuthenticationEntryPoint@3ac69616 2022-03-30 08:24:03.608 INFO 9 --- [ main] c.a.s.p.internal.LambdaContainerHandler : test-invoke-source-ip arn:aws:sts::#########:assumed-role/#########arn:aws:sts::#########:assumed-role/######### arn:aws:sts::#########:assumed-role/######### [30/03/2022:08:24:03Z] "GET /auth/v1/healthCheck HTTP/1.1" 401 - "#########:#########" "aws-internal/3 aws-sdk-java/1.12.162 Linux/5.4.176-103.347.amzn2int.x86_64 OpenJDK_64-Bit_Server_VM/25.322-b06 java/1.8.0_322 vendor/Oracle_Corporation cfg/retry-mode/standard" combined END RequestId: 7936b777-82e6-4a54-bda8-04f4a36f52db

Much Appreciated if resolved soon. Thankyou

deki commented 2 years ago

Thanks for your issue report. Could you please also attach the stacktrace for the NullPointerException you mentioned?

What request do it need to trigger to reproduce the issue?

karpagamvijayan commented 2 years ago
Log Output when no content type was set which throws NullPointerException START RequestId: Version: $LATEST -- 2022-03-31 13:21:32.077 INFO --- [ main] c.a.s.p.internal.LambdaContainerHandler : Starting Lambda Container Handler 2022-03-31 13:21:32.356 INFO --- [ Thread-0] c.a.s.proxy.AsyncInitializationWrapper : Starting async initializer 2022-03-31 13:21:32.356 INFO --- [ main] c.a.s.proxy.AsyncInitializationWrapper : Async initialization will wait for 8381ms . ____ _ __ _ _ /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \ ( ( )\___ \| '_ \| '_\| \| '_ \/ _` \| \ \ \ \ \\/ ___)\| \|_)\| \| \| \| \| \|\| (_\| \| ) ) ) ) ' \|____\| .__\|_\| \|_\|_\| \|_\__, \| / / / / =========\|_\|==============\|___/=/_/_/_/ :: Spring Boot :: (v2.6.3) 2022-03-31 13:21:39.232 INFO 9 --- [ Thread-0] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [name: default] 2022-03-31 13:21:39.335 INFO 9 --- [ Thread-0] org.hibernate.Version : HHH000412: Hibernate ORM core version 5.6.4.Final 2022-03-31 13:21:39.616 INFO 9 --- [ Thread-0] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.1.2.Final} 2022-03-31 13:21:39.844 INFO 9 --- [ Thread-0] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting... 2022-03-31 13:21:40.204 INFO 9 --- [ Thread-0] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed. 2022-03-31 13:21:40.224 INFO 9 --- [ Thread-0] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.MySQL5InnoDBDialect 2022-03-31 13:21:40.737 INFO 9 --- [ main] c.a.s.proxy.AsyncInitializationWrapper : Initialization took longer than 10000, setting new CountDownLatch and continuing in event handler 2022-03-31 13:21:42.364 INFO 9 --- [ Thread-0] o.h.e.t.j.p.i.JtaPlatformInitiator : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform] 2022-03-31 13:21:53.798 DEBUG 9 --- [ Thread-0] edFilterInvocationSecurityMetadataSource : Adding web access control expression [authenticated] for any request 2022-03-31 13:21:53.871 INFO 9 --- [ Thread-0] o.s.s.web.DefaultSecurityFilterChain : Will secure Ant [pattern='/oauth/**'] with [org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter@280682d4, org.springframework.security.web.context.SecurityContextPersistenceFilter@1d919f48, org.springframework.security.web.header.HeaderWriterFilter@53a24c5e, org.springframework.security.web.csrf.CsrfFilter@1b9108fc, org.springframework.security.web.authentication.logout.LogoutFilter@4263c967, org.springframework.security.oauth2.server.resource.web.BearerTokenAuthenticationFilter@5337cb4d, org.springframework.security.web.savedrequest.RequestCacheAwareFilter@77fbbd18, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter@36c3c09d, org.springframework.security.web.authentication.AnonymousAuthenticationFilter@37302e14, org.springframework.security.web.session.SessionManagementFilter@324bd55b, org.springframework.security.web.access.ExceptionTranslationFilter@70a1dbb9, org.springframework.security.web.access.intercept.FilterSecurityInterceptor@7136701, org.springframework.security.web.access.intercept.AuthorizationFilter@5799ab29] 2022-03-31 13:21:59.355 ERROR 9 --- [ main] c.a.s.p.internal.LambdaContainerHandler : Error while handling request java.lang.NullPointerException: null at com.amazonaws.serverless.proxy.internal.servlet.AwsProxyHttpServletRequest.getContentType(AwsProxyHttpServletRequest.java:340) at org.springframework.http.server.reactive.ServletServerHttpRequest.initHeaders(ServletServerHttpRequest.java:136) at org.springframework.http.server.reactive.ServletServerHttpRequest.(ServletServerHttpRequest.java:90) at org.springframework.http.server.reactive.ServletServerHttpRequest.(ServletServerHttpRequest.java:83) at org.springframework.http.server.reactive.ServletHttpHandlerAdapter.createRequest(ServletHttpHandlerAdapter.java:206) at org.springframework.http.server.reactive.ServletHttpHandlerAdapter.service(ServletHttpHandlerAdapter.java:173) at com.amazonaws.serverless.proxy.spring.embedded.ServerlessReactiveServletEmbeddedServerFactory.service(ServerlessReactiveServletEmbeddedServerFactory.java:71) at com.amazonaws.serverless.proxy.internal.servlet.FilterChainManager$ServletExecutionFilter.doFilter(FilterChainManager.java:356) at com.amazonaws.serverless.proxy.internal.servlet.FilterChainHolder.doFilter(FilterChainHolder.java:90) at com.amazonaws.serverless.proxy.internal.servlet.AwsLambdaServletContainerHandler.doFilter(AwsLambdaServletContainerHandler.java:156) at com.amazonaws.serverless.proxy.spring.SpringBootLambdaContainerHandler.handleRequest(SpringBootLambdaContainerHandler.java:180) at com.amazonaws.serverless.proxy.spring.SpringBootLambdaContainerHandler.handleRequest(SpringBootLambdaContainerHandler.java:53) at com.amazonaws.serverless.proxy.internal.LambdaContainerHandler.proxy(LambdaContainerHandler.java:214) at com.amazonaws.serverless.proxy.internal.LambdaContainerHandler.proxyStream(LambdaContainerHandler.java:257) at com.sample.karpagam.vijayan.StreamLambdaHandler.handleRequest(StreamLambdaHandler.java:56) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at lambdainternal.EventHandlerLoader$StreamMethodRequestHandler.handleRequest(EventHandlerLoader.java:356) at lambdainternal.EventHandlerLoader$2.call(EventHandlerLoader.java:903) at lambdainternal.AWSLambda.startRuntime(AWSLambda.java:349) at lambdainternal.AWSLambda.(AWSLambda.java:70) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:348) at lambdainternal.LambdaRTEntry.main(LambdaRTEntry.java:150) 2022-03-31 13:21:59.355 ERROR 9 --- [ main] c.a.s.proxy.AwsProxyExceptionHandler : Called exception handler for: java.lang.NullPointerException: null at com.amazonaws.serverless.proxy.internal.servlet.AwsProxyHttpServletRequest.getContentType(AwsProxyHttpServletRequest.java:340) at org.springframework.http.server.reactive.ServletServerHttpRequest.initHeaders(ServletServerHttpRequest.java:136) at org.springframework.http.server.reactive.ServletServerHttpRequest.(ServletServerHttpRequest.java:90) at org.springframework.http.server.reactive.ServletServerHttpRequest.(ServletServerHttpRequest.java:83) at org.springframework.http.server.reactive.ServletHttpHandlerAdapter.createRequest(ServletHttpHandlerAdapter.java:206) at org.springframework.http.server.reactive.ServletHttpHandlerAdapter.service(ServletHttpHandlerAdapter.java:173) at com.amazonaws.serverless.proxy.spring.embedded.ServerlessReactiveServletEmbeddedServerFactory.service(ServerlessReactiveServletEmbeddedServerFactory.java:71) at com.amazonaws.serverless.proxy.internal.servlet.FilterChainManager$ServletExecutionFilter.doFilter(FilterChainManager.java:356) at com.amazonaws.serverless.proxy.internal.servlet.FilterChainHolder.doFilter(FilterChainHolder.java:90) at com.amazonaws.serverless.proxy.internal.servlet.AwsLambdaServletContainerHandler.doFilter(AwsLambdaServletContainerHandler.java:156) at com.amazonaws.serverless.proxy.spring.SpringBootLambdaContainerHandler.handleRequest(SpringBootLambdaContainerHandler.java:180) at com.amazonaws.serverless.proxy.spring.SpringBootLambdaContainerHandler.handleRequest(SpringBootLambdaContainerHandler.java:53) at com.amazonaws.serverless.proxy.internal.LambdaContainerHandler.proxy(LambdaContainerHandler.java:214) at com.amazonaws.serverless.proxy.internal.LambdaContainerHandler.proxyStream(LambdaContainerHandler.java:257) at com.sample.karpagam.vijayan.StreamLambdaHandler.handleRequest(StreamLambdaHandler.java:56) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at lambdainternal.EventHandlerLoader$StreamMethodRequestHandler.handleRequest(EventHandlerLoader.java:356) at lambdainternal.EventHandlerLoader$2.call(EventHandlerLoader.java:903) at lambdainternal.AWSLambda.startRuntime(AWSLambda.java:349) at lambdainternal.AWSLambda.(AWSLambda.java:70) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:348) at lambdainternal.LambdaRTEntry.main(LambdaRTEntry.java:150) java.lang.NullPointerException at com.amazonaws.serverless.proxy.internal.servlet.AwsProxyHttpServletRequest.getContentType(AwsProxyHttpServletRequest.java:340) at org.springframework.http.server.reactive.ServletServerHttpRequest.initHeaders(ServletServerHttpRequest.java:136) at org.springframework.http.server.reactive.ServletServerHttpRequest.(ServletServerHttpRequest.java:90) at org.springframework.http.server.reactive.ServletServerHttpRequest.(ServletServerHttpRequest.java:83) at org.springframework.http.server.reactive.ServletHttpHandlerAdapter.createRequest(ServletHttpHandlerAdapter.java:206) at org.springframework.http.server.reactive.ServletHttpHandlerAdapter.service(ServletHttpHandlerAdapter.java:173) at com.amazonaws.serverless.proxy.spring.embedded.ServerlessReactiveServletEmbeddedServerFactory.service(ServerlessReactiveServletEmbeddedServerFactory.java:71) at com.amazonaws.serverless.proxy.internal.servlet.FilterChainManager$ServletExecutionFilter.doFilter(FilterChainManager.java:356) at com.amazonaws.serverless.proxy.internal.servlet.FilterChainHolder.doFilter(FilterChainHolder.java:90) at com.amazonaws.serverless.proxy.internal.servlet.AwsLambdaServletContainerHandler.doFilter(AwsLambdaServletContainerHandler.java:156) at com.amazonaws.serverless.proxy.spring.SpringBootLambdaContainerHandler.handleRequest(SpringBootLambdaContainerHandler.java:180) at com.amazonaws.serverless.proxy.spring.SpringBootLambdaContainerHandler.handleRequest(SpringBootLambdaContainerHandler.java:53) at com.amazonaws.serverless.proxy.internal.LambdaContainerHandler.proxy(LambdaContainerHandler.java:214) at com.amazonaws.serverless.proxy.internal.LambdaContainerHandler.proxyStream(LambdaContainerHandler.java:257) at com.sample.karpagam.vijayan.StreamLambdaHandler.handleRequest(StreamLambdaHandler.java:56) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at lambdainternal.EventHandlerLoader$StreamMethodRequestHandler.handleRequest(EventHandlerLoader.java:356) at lambdainternal.EventHandlerLoader$2.call(EventHandlerLoader.java:903) at lambdainternal.AWSLambda.startRuntime(AWSLambda.java:349) at lambdainternal.AWSLambda.(AWSLambda.java:70) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:348) at lambdainternal.LambdaRTEntry.main(LambdaRTEntry.java:150) END RequestId: e104a78c-6e59-436c-95a5-6d7f6dfbb13d REPORT RequestId: e104a78c-6e59-436c-95a5-6d7f6dfbb13d Duration: 18750.01 ms Billed Duration: 18751 ms Memory Size: 1024 MB Max Memory Used: 344 MB Init Duration: 9942.51 ms **What request do it need to trigger to reproduce the issue?** Added the azure ad dependency dependency in pom.xml 1) groupId - com.azure.spring artifactId - azure-spring-boot-starter-active-directory version - 3.9.0 2) groupId - org.springframework.boot artifactId - spring-boot-starter-oauth2-resource-server and in the security configuration of spring boot application added as below import java.util.Arrays; import java.util.Collections; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.core.annotation.Order; import org.springframework.http.HttpMethod; import org.springframework.security.authentication.AuthenticationManager; import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.builders.WebSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org.springframework.security.config.http.SessionCreationPolicy; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.security.web.authentication.AuthenticationFailureHandler; import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; import org.springframework.web.cors.CorsConfiguration; import org.springframework.web.cors.CorsConfigurationSource; import org.springframework.web.cors.UrlBasedCorsConfigurationSource; import com.azure.spring.aad.webapi.AADResourceServerWebSecurityConfigurerAdapter; import com.sample.karpagam.vijayan.security.CustomAccessDeniedHandler; import com.sample.karpagam.vijayan.security.CustomJwtAuthenticationEntryPoint; import com.sample.karpagam.vijayan.security.JwtAuthenticationFilter; import com.sample.karpagam.vijayan.service.UserDetailsServiceImpl; @Configuration @EnableWebSecurity public class SecurityConfig{ private static final String[] AUTH_WHITELIST = { // -- Swagger UI v2 "/v2/api-docs", "/swagger-resources", "/swagger-resources/**", "/configuration/ui", "/configuration/security", "/swagger-ui.html", "/webjars/**", // -- Swagger UI v3 (OpenAPI) "/v3/api-docs/**", "/swagger-ui/**", "/oauth", "/oauth/**", // other public endpoints of your API may be appended to this array "/auth/v1/**" }; @Autowired private CustomJwtAuthenticationEntryPoint authenticationEntryPoint; @Autowired private DatabaseAuthenticationProvider dbAuthenticationProvider; @Autowired private CustomAccessDeniedHandler accessDeniedHandler; @Autowired private UserDetailsServiceImpl userDetailsService; @Bean public JwtAuthenticationFilter jwtAuthenticationFilter(){ return new JwtAuthenticationFilter(); } @Bean PasswordEncoder passwordEncoder(){ return new BCryptPasswordEncoder(); } CorsConfigurationSource corsConfigurationSource() { CorsConfiguration configuration = new CorsConfiguration(); List allowOrigins = Arrays.asList("*"); configuration.setAllowedOriginPatterns(allowOrigins); configuration.setAllowedMethods(Collections.singletonList("*")); configuration.setAllowedHeaders(Collections.singletonList("*")); configuration.setAllowCredentials(true); UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); source.registerCorsConfiguration("/**", configuration); return source; } @Configuration @Order(1) public class SecurityConfigDB extends WebSecurityConfigurerAdapter { @Override protected void configure(HttpSecurity http) throws Exception { http.cors().configurationSource(corsConfigurationSource()); http.antMatcher("/api/**").csrf().disable() .exceptionHandling() .authenticationEntryPoint(authenticationEntryPoint) .accessDeniedHandler(accessDeniedHandler) .and() .sessionManagement() .sessionCreationPolicy(SessionCreationPolicy.STATELESS) .and() .authorizeRequests() .antMatchers(AUTH_WHITELIST).permitAll() .anyRequest() .authenticated() ; http.addFilterBefore(jwtAuthenticationFilter(), UsernamePasswordAuthenticationFilter.class); } @Override protected void configure(AuthenticationManagerBuilder auth) throws Exception { auth.authenticationProvider(dbAuthenticationProvider); } @Override @Bean public AuthenticationManager authenticationManagerBean() throws Exception { return super.authenticationManagerBean(); } } @Configuration @Order(2) public class AADSecurityConfig extends AADResourceServerWebSecurityConfigurerAdapter { /** * Add configuration logic as needed. */ @Override protected void configure(HttpSecurity http) throws Exception { super.configure(http); http.cors().configurationSource(corsConfigurationSource()); http.antMatcher("/oauth/**").csrf().disable() .exceptionHandling() .authenticationEntryPoint(authenticationEntryPoint) .accessDeniedHandler(accessDeniedHandler) .and() .sessionManagement() .sessionCreationPolicy(SessionCreationPolicy.STATELESS) .and() .authorizeRequests((requests) -> requests.anyRequest().authenticated()); } } }
deki commented 2 years ago

Thanks for the additional information. Just to confirm you are really using the 1.6 release as stated above?

I'm a bit confused because line numbers don't really match: https://github.com/awslabs/aws-serverless-java-container/blob/aws-serverless-java-container-1.6/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsProxyHttpServletRequest.java#L340

karpagamvijayan commented 2 years ago

Yes @deki I have used 1.6 version PFB the updated logs.

2022-03-31 14:17:04.126 ERROR 9 --- [ main] c.a.s.p.internal.LambdaContainerHandler : Error while handling request -- java.lang.NullPointerException: null at com.amazonaws.serverless.proxy.internal.servlet.AwsProxyHttpServletRequest.getContentType(AwsProxyHttpServletRequest.java:337) at org.springframework.http.server.reactive.ServletServerHttpRequest.initHeaders(ServletServerHttpRequest.java:136) at org.springframework.http.server.reactive.ServletServerHttpRequest.(ServletServerHttpRequest.java:90) at org.springframework.http.server.reactive.ServletServerHttpRequest.(ServletServerHttpRequest.java:83) at org.springframework.http.server.reactive.ServletHttpHandlerAdapter.createRequest(ServletHttpHandlerAdapter.java:206) at org.springframework.http.server.reactive.ServletHttpHandlerAdapter.service(ServletHttpHandlerAdapter.java:173) at com.amazonaws.serverless.proxy.spring.embedded.ServerlessReactiveServletEmbeddedServerFactory.service(ServerlessReactiveServletEmbeddedServerFactory.java:71) at com.amazonaws.serverless.proxy.internal.servlet.FilterChainManager$ServletExecutionFilter.doFilter(FilterChainManager.java:356) at com.amazonaws.serverless.proxy.internal.servlet.FilterChainHolder.doFilter(FilterChainHolder.java:90) at com.amazonaws.serverless.proxy.internal.servlet.AwsLambdaServletContainerHandler.doFilter(AwsLambdaServletContainerHandler.java:156) at com.amazonaws.serverless.proxy.spring.SpringBootLambdaContainerHandler.handleRequest(SpringBootLambdaContainerHandler.java:180) at com.amazonaws.serverless.proxy.spring.SpringBootLambdaContainerHandler.handleRequest(SpringBootLambdaContainerHandler.java:53) at com.amazonaws.serverless.proxy.internal.LambdaContainerHandler.proxy(LambdaContainerHandler.java:214) at com.amazonaws.serverless.proxy.internal.LambdaContainerHandler.proxyStream(LambdaContainerHandler.java:257) at com.sample.karpagam.vijayan.StreamLambdaHandler.handleRequest(StreamLambdaHandler.java:56) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at lambdainternal.EventHandlerLoader$StreamMethodRequestHandler.handleRequest(EventHandlerLoader.java:356) at lambdainternal.EventHandlerLoader$2.call(EventHandlerLoader.java:903) at lambdainternal.AWSLambda.startRuntime(AWSLambda.java:349) at lambdainternal.AWSLambda.(AWSLambda.java:70) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:348) at lambdainternal.LambdaRTEntry.main(LambdaRTEntry.java:150) 2022-03-31 14:17:04.144 ERROR 9 --- [ main] c.a.s.proxy.AwsProxyExceptionHandler : Called exception handler for: java.lang.NullPointerException: null at com.amazonaws.serverless.proxy.internal.servlet.AwsProxyHttpServletRequest.getContentType(AwsProxyHttpServletRequest.java:337) at org.springframework.http.server.reactive.ServletServerHttpRequest.initHeaders(ServletServerHttpRequest.java:136) at org.springframework.http.server.reactive.ServletServerHttpRequest.(ServletServerHttpRequest.java:90) at org.springframework.http.server.reactive.ServletServerHttpRequest.(ServletServerHttpRequest.java:83) at org.springframework.http.server.reactive.ServletHttpHandlerAdapter.createRequest(ServletHttpHandlerAdapter.java:206) at org.springframework.http.server.reactive.ServletHttpHandlerAdapter.service(ServletHttpHandlerAdapter.java:173) at com.amazonaws.serverless.proxy.spring.embedded.ServerlessReactiveServletEmbeddedServerFactory.service(ServerlessReactiveServletEmbeddedServerFactory.java:71) at com.amazonaws.serverless.proxy.internal.servlet.FilterChainManager$ServletExecutionFilter.doFilter(FilterChainManager.java:356) at com.amazonaws.serverless.proxy.internal.servlet.FilterChainHolder.doFilter(FilterChainHolder.java:90) at com.amazonaws.serverless.proxy.internal.servlet.AwsLambdaServletContainerHandler.doFilter(AwsLambdaServletContainerHandler.java:156) at com.amazonaws.serverless.proxy.spring.SpringBootLambdaContainerHandler.handleRequest(SpringBootLambdaContainerHandler.java:180) at com.amazonaws.serverless.proxy.spring.SpringBootLambdaContainerHandler.handleRequest(SpringBootLambdaContainerHandler.java:53) at com.amazonaws.serverless.proxy.internal.LambdaContainerHandler.proxy(LambdaContainerHandler.java:214) at com.amazonaws.serverless.proxy.internal.LambdaContainerHandler.proxyStream(LambdaContainerHandler.java:257) at com.sample.karpagam.vijayan.StreamLambdaHandler.handleRequest(StreamLambdaHandler.java:56) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at lambdainternal.EventHandlerLoader$StreamMethodRequestHandler.handleRequest(EventHandlerLoader.java:356) at lambdainternal.EventHandlerLoader$2.call(EventHandlerLoader.java:903) at lambdainternal.AWSLambda.startRuntime(AWSLambda.java:349) at lambdainternal.AWSLambda.(AWSLambda.java:70) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:348) at lambdainternal.LambdaRTEntry.main(LambdaRTEntry.java:150)
karpagamvijayan commented 2 years ago

any help please?

deki commented 2 years ago

@karpagamvijayan I tried to reproduce the issue as described but the class you pasted doesn't work: package com.sample.karpagam.vijayan.security does not exist

Would it be possible for you to provide a repo that I can just clone?