X Tutup
Skip to content

Service resolve error when 'UseConnectionPaging()' #459

@BRUS1NATOR

Description

@BRUS1NATOR

Getting an error when trying to resolve service inside query when using UseConnectionPaging extension.

How to reproduce (demo project)

Define schema (something like #78):

demoScashema.Query().ReplaceField("people", "Get a page of people").Resolve<IHttpContextAccessor>((ctx, service) => ctx.People.Where(e => e.FirstName != service.HttpContext!.User.Identity!.Name)).UseConnectionPaging();

Send request { people { edges { node { id } } } } and get error response:

{
	"errors": [
		{
			"message": "Field 'people' - variable 'service' of type 'Microsoft.AspNetCore.Http.IHttpContextAccessor' referenced from scope '', but it is not defined"
		}
	]
}

Remove UseConnectionPaging and you will get no errors for { people { id } }

demoSchema.Query().ReplaceField("people", "Get a page of people").Resolve<IHttpContextAccessor>((ctx, service) => ctx.People.Where(e => e.FirstName != service.HttpContext!.User.Identity!.Name))

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      X Tutup