Describe the bug
When upgrading to the new beta version an issue raised with calling any graphql query, with the message: array_merge(): Argument #2 is not an array
Expected behavior
Get a list back of invoices like in v3.0-alpha.1
Schema
type Invoice {
id: String! @rename(attribute: "provider_id")
paid: Boolean
formatted_total: String
date: DateTime @rename(attribute: "created_at")
}
type Query @group(middleware: ["auth:api"]) {
invoices(team_id: String! @eq): [Invoice] @field(resolver: "App\\Http\\GraphQL\\Query@invoices")
}
Output/Logs
Click to expand
{#2528
+"message": "array_merge(): Argument #2 is not an array"
+"exception": "ErrorException"
+"file": "/Users/evandam/Sites/scaling/vendor/nuwave/lighthouse/src/GraphQL.php"
+"line": 209
+"trace": array:54 [
0 => {#2800
+"function": "handleError"
+"class": "Illuminate\Foundation\Bootstrap\HandleExceptions"
+"type": "->"
}
1 => {#2942
+"file": "/Users/evandam/Sites/scaling/vendor/nuwave/lighthouse/src/GraphQL.php"
+"line": 209
+"function": "array_merge"
}
2 => {#2944
+"file": "/Users/evandam/Sites/scaling/vendor/nuwave/lighthouse/src/GraphQL.php"
+"line": 130
+"function": "executeQuery"
+"class": "Nuwave\Lighthouse\GraphQL"
+"type": "->"
}
3 => {#2530
+"file": "/Users/evandam/Sites/scaling/vendor/nuwave/lighthouse/src/Support/Http/Controllers/GraphQLController.php"
+"line": 70
+"function": "executeRequest"
+"class": "Nuwave\Lighthouse\GraphQL"
+"type": "->"
}
Environment
Lighthouse Version: v3.0-beta.1
Laravel Version: v5.8.4
PHP Version: 7.2.15
Additional context
When adding in the following code at line 203 in GraphQL.php everything seems to be fine again.
if(is_null($singleExtensionResult)) {
$singleExtensionResult = [];
}
I think I am having the same issue on the latest master. 2nd argument array expected, null given.
@georgeboot it should definitely be fixed with #670, can you make sure the commit hash in composer.lock lines up and you are actually getting the latest version?
@spawnia We're currently locked on dc47a1718a09f5988ef23a534f0bca7571fbb8eb because that one does not have the bug yet.
Installed dev-master (0abeda911efa4337dadfa7e251bb02763225dee5) this morning but that still had the error.
Resolution
As you can see, that hash is not the latest on github. Probably because you guys don't sync with packagist on every commit (can you please enable this or is there a specific reason for this?). Thus, it never installed the latest version.
Will wait until beta comes available via packgist and then install it.
Waiting on @chrissm79 to fix the issue with packagist. In the meantime, you can get the latest straight from GitHub by adding the following to composer.json:
"repositories": [
{
"url": "https://github.com/nuwave/lighthouse.git",
"type": "git"
}
],
Most helpful comment
Waiting on @chrissm79 to fix the issue with packagist. In the meantime, you can get the latest straight from GitHub by adding the following to
composer.json: