Error when using IFile type (Unable to find type(s) Upload!, HotChocolate.Types.StringType (HotChocolate.Types.ObjectType)) HotChocolate

35 views Asked by At

Errors:

1. Unable to find type(s) Upload, HotChocolate.Types.StringType (HotChocolate.Types.ObjectType)
2. Unable to resolve dependencies String!, String!, String!, String!, String!, String!, String!, String!, String!, String!, String, String, Upload for type `AuthMutation`. (HotChocolate.Types.ObjectType)

The error occurs in the gateway microservice when I try to load the schematic on the http://localhost:5234/graphql/ page. (The error is most likely due to improper configuration of the gateway microservice.)

enter image description here

The error occurs only on the gateway microservice. If you start another micro service and try to load the scheme, everything will be fine.

Graph QL configuration in gateway microservice:

public static IServiceCollection AddRemoteGraphQL(this IServiceCollection services)
    {
        services
            .AddHttpClient(OAuthService, client =>
            {
                client.BaseAddress = new Uri("http://localhost:5252/graphql");
            })
            .AddHttpMessageHandler((provider) => {
                var httpContextAccessor = provider.GetRequiredService<IHttpContextAccessor>();
                return new AuthHeaderHandler(httpContextAccessor);
            });

        services
            .AddGraphQLServer()
            .AddType<UploadType>()
            .AddRemoteSchema(OAuthService, ignoreRootTypes: false);

        return services;
    }

Graph QL configuration in another microservice:

public static IServiceCollection AddGraphQL(this IServiceCollection services)
    {
        services
            .AddGraphQLServer()
            .AddAuthorization()
            .AddMutationType<AuthMutation>()
            .AddQueryType<AuthQuery>()
            .AddType<UploadType>()
            .UseDefaultPipeline();

        return services;
    }

The main problem I'm trying to solve is uploading pictures to the server, so if there are other ways to realize the uploading of pictures to the server they are also suitable, the main requirement is the use of GraphQL HotChocolate v13 and Dotnet 8.0.

I have tried most of the solutions that GPT Chat suggested to me and the ones I could find on the internet. But it does not give any results, the error still appears.

0

There are 0 answers