Skip to content

[Bug]: swa local run returns always "The argument name is invalid. (Parameter 'argumentName') #1680

@bitsmakerde

Description

@bitsmakerde

What happened?

After I move my azure cloud project to an other subscription group I get this error. BU this error comes only on my local machine Not when I deploy and run my swa an azure.

I get this error:

  "errors": [
    {
      "message": "The argument name is invalid. (Parameter 'argumentName')",
      "locations": [
        {
          "line": 5,
          "column": 3
        }
      ],
      "path": [
        "machine_by_pk"
      ]
    }
  ],
  "data": {
    "machine_by_pk": null
  }
}

When I run this query:

{
  machine_by_pk(id: "5d4b8c6c-9df0-45fd-9312-40a527c417e5", _partitionKeyValue: "5d4b8c6c-9df0-45fd-9312-40a527c417e5") {
    id
  
  }
}

What I not understand is when I run this command local all works fine:

{
  machines {
    items {
      id
      type
      companyID
      name
      modelNumber
      location
    }
    endCursor
    hasNextPage
  }
}

And I get the machine from the first query, with all values:

{
  "data": {
    "machines": {
      "items": [
        {
          "id": "5d4b8c6c-9df0-45fd-9312-40a527c417e5",
          "type": "machine",
          "companyID": "1",
          "name": "maschine 1",
          "modelNumber": null,
          "location": "noLocation"
        },
        {
          "id": "7445e939-4508-40ad-880d-29af612cf93d",
          "type": "machine",
          "companyID": "1",
          "name": "Maschine 2",
          "modelNumber": null,
          "location": "noLocation"
        },
        {
          "id": "9f7c4c21-9945-4ec9-99f7-c7393b5492eb",
          "type": "machine",
          "companyID": "1",
          "name": "machine 3",
          "modelNumber": null,
          "location": "noLocation"
        }
      ],
      "endCursor": null,
      "hasNextPage": false
    }
  }
}

I change nothing on my local side without this:

staticwebapp.database.config.json

"rest": {
            "enabled": false,
            "path": "/api"
        },

Without the local stock will not anymore start.

Version

swa cli 1.1.4

What database are you using?

CosmosDB NoSQL

What hosting model are you using?

No response

Which API approach are you accessing DAB through?

No response

Relevant log output

"errors": [
    {
      "message": "The argument name is invalid. (Parameter 'argumentName')",
      "locations": [
        {
          "line": 5,
          "column": 3
        }
      ],
      "path": [
        "machine_by_pk"
      ]
    }
  ],
  "data": {
    "machine_by_pk": null
  }
}

here the console log for my request.

[swa] POST http://localhost:5000/graphql/ (proxy)
[dataApi] info: Microsoft.AspNetCore.Hosting.Diagnostics[1]
[dataApi]       Request starting HTTP/1.1 POST http://localhost:4280/graphql/ application/json 371
[dataApi] info: Microsoft.AspNetCore.Cors.Infrastructure.CorsService[4]
[dataApi]       CORS policy execution successful.
[dataApi] info: Microsoft.AspNetCore.Routing.EndpointMiddleware[0]
[dataApi]       Executing endpoint 'Hot Chocolate GraphQL Pipeline'
[dataApi] fail: Azure.DataApiBuilder.Service.Startup[0]
[dataApi]       The argument name is invalid. (Parameter 'argumentName')
[dataApi] fail: Azure.DataApiBuilder.Service.Startup[0]
[dataApi]          at HotChocolate.Types.Directive.GetArgument[T](String argumentName)
[dataApi]          at Azure.DataApiBuilder.Service.GraphQLBuilder.GraphQLUtils.TryExtractGraphQLFieldModelName(IDirectiveCollection fieldDirectives, String& modelName) in /_/src/Service.GraphQLBuilder/GraphQLUtils.cs:line 181
[dataApi]          at Azure.DataApiBuilder.Core.Resolvers.CosmosQueryStructure.Init(IDictionary`2 queryParams) in /_/src/Core/Resolvers/CosmosQueryStructure.cs:line 113
[dataApi]          at Azure.DataApiBuilder.Core.Resolvers.CosmosQueryEngine.ExecuteAsync(IMiddlewareContext context, IDictionary`2 parameters) in /_/src/Core/Resolvers/CosmosQueryEngine.cs:line 59
[dataApi]          at Azure.DataApiBuilder.Core.Services.ResolverMiddleware.InvokeAsync(IMiddlewareContext context) in /_/src/Core/Services/ResolverMiddleware.cs:line 91
[dataApi]          at HotChocolate.Utilities.MiddlewareCompiler`1.ExpressionHelper.AwaitTaskHelper(Task task)
         at HotChocolate.Execution.Processing.Tasks.ResolverTask.ExecuteResolverPipelineAsync(CancellationToken cancellationToken)
[dataApi]          at HotChocolate.Execution.Processing.Tasks.ResolverTask.TryExecuteAsync(CancellationToken cancellationToken)
[dataApi] info: Microsoft.AspNetCore.Routing.EndpointMiddleware[1]
[dataApi]       Executed endpoint 'Hot Chocolate GraphQL Pipeline'

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Labels

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions