1

I am building a multimodule springboot application, I have one module that only does graphql queries and mutations, the challenge am facing is when I try to run the app and query graphql I end up getting 404 not found

{
    "timestamp": "2023-01-25T18:25:00.762+00:00",
    "status": 404,
    "error": "Not Found",
    "message": "No message available",
    "path": "/graphql"
}

The query am running

query{
  retailers{
    ...allfields
  }
}

I am using Netflix graphql. Here Is my configuration build.gradle.kts file

plugins {
    `java-library`
    id("app-java-conventions")
    id("com.netflix.dgs.codegen")
    id("com.google.cloud.tools.jib")
    // for jib agent look into https://github.com/GoogleContainerTools/jib/tree/master/examples/java-agent
}

dependencyManagement {
    imports {
        mavenBom("com.netflix.graphql.dgs:graphql-dgs-platform-dependencies:latest.release")
    }
}

dependencies {
    implementation(project(":ky-launch-darkly"))
    implementation(platform("com.netflix.graphql.dgs:graphql-dgs-platform-dependencies:latest.release"))
    implementation("com.netflix.graphql.dgs:graphql-dgs-spring-boot-starter")
    implementation("com.netflix.graphql.dgs:graphql-dgs-extended-scalars")
    implementation("com.netflix.graphql.dgs:graphql-dgs-subscriptions-websockets-autoconfigure")
    implementation("org.springframework.boot:spring-boot-starter-web")
    implementation("com.netflix.graphql.dgs:graphql-dgs-spring-boot-starter")
    implementation("net.devh:grpc-client-spring-boot-starter:2.13.1.RELEASE")
    implementation("org.springframework.boot:spring-boot-starter-actuator")
    implementation("net.datafaker:datafaker:1.7.0")

}

my folder structure looks like this for graphql schema

enter image description here

Am using keycloak for authentication but I have permitted access to all graphql endpoints

@Override
    protected void configure(HttpSecurity http) throws Exception {
        http
                .csrf().disable()
                .authorizeRequests()
                .antMatchers("/**").permitAll()
                .and()
                .requestCache()
                .requestCache(new NullRequestCache())
                .and()
                .headers()
                .frameOptions().sameOrigin() // needed for H2 web console
                .and()
                .sessionManagement()
                .maximumSessions(1)
                .maxSessionsPreventsLogin(true)
                .sessionRegistry(sessionRegistry());
    }

I have a data resolver for the graphql

@DgsComponent
public class RetailerDataResolver {

    @DgsQuery
    public List<Retailer> retailers(){
        return RetailerDatasource.RETAILER_LIST;
    }
}

what could I be doing wrong on my app such that I cant access graphql?

justrying
  • 69
  • 7

0 Answers0