I'm getting this error after updating to prisma 1.1.3:
[Network error]: TypeError: results.filter is not a function
Error: results.filter is not a function
at Object.checkResultAndHandleErrors (C:\workspace\cool-project\server\node_modules\graphql-tools\dist\stitching\errors.js:69:36)
at Object.<anonymous> (C:\workspace\cool-project\server\node_modules\graphql-tools\dist\stitching\delegateToSchema.js:89:52)
at step (C:\workspace\cool-project\server\node_modules\graphql-tools\dist\stitching\delegateToSchema.js:40:23)
at Object.next (C:\workspace\cool-project\server\node_modules\graphql-tools\dist\stitching\delegateToSchema.js:21:53)
at fulfilled (C:\workspace\cool-project\server\node_modules\graphql-tools\dist\stitching\delegateToSchema.js:12:58)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
And if I run prisma deploy I get this error:
ERROR: Whoops. Looks like an internal server error. Search your cluster logs for request ID: cluster:cluster:cjdbqdz8x000q0116ryv9ikz7
{
"data": {
"addProject": null
},
"errors": [
{
"message": "Whoops. Looks like an internal server error. Search your cluster logs for request ID: cluster:cluster:cjdbqdz8x000q0116ryv9ikz7",
"path": [
"addProject"
],
"locations": [
{
"line": 2,
"column": 9
}
],
"requestId": "cluster:cluster:cjdbqdz8x000q0116ryv9ikz7"
}
],
"status": 200
}
I've just run npm i -g prisma and prisma local upgrade. Should I do anything else to upgrade my project?
What is the operation (query or mutation) that you receive the internal error for?
Which cluster is your service deployed to?
This is the query I'm sending to the local cluster:
query LoggedIn {
user {
id
__typename
}
}
I get the same error message for any operation: results.filter is not a function
What do your cluster logs look like for this request? You can check with prisma cluster logs.
I can see this from the logs:
prisma-database_1 | Feb 06, 2018 2:48:31 PM com.github.benmanes.caffeine.cache.LocalAsyncLoadingCache lambda$get$3
prisma-database_1 | WARNING: Exception thrown during asynchronous load
prisma-database_1 | play.api.libs.json.JsResultException: JsResultException(errors:List((/models(2)/fields(5)/relation/modelBOnDelete,List(JsonValidationError(List(error.path.missing),WrappedArray()))), (/models(2)/fields(6)/relation/modelAOnDelete,List(JsonValidationError(List(error.path.missing),WrappedArray()))), (/relations(0)/modelAOnDelete,List(JsonValidationError(List(error.path.missing),WrappedArray()))), (/models(3)/fields(5)/relation/modelAOnDelete,List(JsonValidationError(List(error.path.missing),WrappedArray()))), (/models(1)/fields(5)/relation/modelBOnDelete,List(JsonValidationError(List(error.path.missing),WrappedArray()))), (/models(1)/fields(4)/relation/modelBOnDelete,List(JsonValidationError(List(error.path.missing),WrappedArray()))), (/relations(0)/modelBOnDelete,List(JsonValidationError(List(error.path.missing),WrappedArray()))), (/models(3)/fields(3)/relation/modelAOnDelete,List(JsonValidationError(List(error.path.missing),WrappedArray()))), (/relations(1)/modelBOnDelete,List(JsonValidationError(List(error.path.missing),WrappedArray()))), (/models(3)/fields(3)/relation/modelBOnDelete,List(JsonValidationError(List(error.path.missing),WrappedArray()))), (/models(4)/fields(3)/relation/modelBOnDelete,List(JsonValidationError(List(error.path.missing),WrappedArray()))), (/relations(1)/modelAOnDelete,List(JsonValidationError(List(error.path.missing),WrappedArray()))), (/models(3)/fields(5)/relation/modelBOnDelete,List(JsonValidationError(List(error.path.missing),WrappedArray()))), (/relations(2)/modelBOnDelete,List(JsonValidationError(List(error.path.missing),WrappedArray()))), (/models(2)/fields(5)/relation/modelAOnDelete,List(JsonValidationError(List(error.path.missing),WrappedArray()))), (/models(0)/fields(6)/relation/modelAOnDelete,List(JsonValidationError(List(error.path.missing),WrappedArray()))), (/models(0)/fields(6)/relation/modelBOnDelete,List(JsonValidationError(List(error.path.missing),WrappedArray()))), (/relations(3)/modelBOnDelete,List(JsonValidationError(List(error.path.missing),WrappedArray()))), (/relations(3)/modelAOnDelete,List(JsonValidationError(List(error.path.missing),WrappedArray()))), (/relations(2)/modelAOnDelete,List(JsonValidationError(List(error.path.missing),WrappedArray()))), (/models(2)/fields(6)/relation/modelBOnDelete,List(JsonValidationError(List(error.path.missing),WrappedArray()))), (/models(4)/fields(3)/relation/modelAOnDelete,List(JsonValidationError(List(error.path.missing),WrappedArray()))), (/models(1)/fields(5)/relation/modelAOnDelete,List(JsonValidationError(List(error.path.missing),WrappedArray()))), (/models(1)/fields(4)/relation/modelAOnDelete,List(JsonValidationError(List(error.path.missing),WrappedArray())))))
prisma-database_1 | at play.api.libs.json.JsReadable.$anonfun$as$2(JsReadable.scala:25)
prisma-database_1 | at play.api.libs.json.JsError.fold(JsResult.scala:56)
prisma-database_1 | at play.api.libs.json.JsReadable.as(JsReadable.scala:24)
prisma-database_1 | at play.api.libs.json.JsReadable.as$(JsReadable.scala:23)
prisma-database_1 | at play.api.libs.json.JsObject.as(JsValue.scala:124)
prisma-database_1 | at com.prisma.deploy.database.persistence.DbToModelMapper$.convert(DbToModelMapper.scala:16)
prisma-database_1 | at com.prisma.deploy.database.persistence.ProjectPersistenceImpl.$anonfun$load$2(ProjectPersistenceImpl.scala:20)
prisma-database_1 | at scala.Option.map(Option.scala:146)
prisma-database_1 | at com.prisma.deploy.database.persistence.ProjectPersistenceImpl.$anonfun$load$1(ProjectPersistenceImpl.scala:19)
prisma-database_1 | at scala.util.Success.$anonfun$map$1(Try.scala:251)
prisma-database_1 | at scala.util.Success.map(Try.scala:209)
prisma-database_1 | at scala.concurrent.Future.$anonfun$map$1(Future.scala:287)
prisma-database_1 | at scala.concurrent.impl.Promise.liftedTree1$1(Promise.scala:29)
prisma-database_1 | at scala.concurrent.impl.Promise.$anonfun$transform$1(Promise.scala:29)
prisma-database_1 | at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:60)
prisma-database_1 | at akka.dispatch.BatchingExecutor$AbstractBatch.processBatch(BatchingExecutor.scala:55)
prisma-database_1 | at akka.dispatch.BatchingExecutor$BlockableBatch.$anonfun$run$1(BatchingExecutor.scala:91)
prisma-database_1 | at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
prisma-database_1 | at scala.concurrent.BlockContext$.withBlockContext(BlockContext.scala:81)
prisma-database_1 | at akka.dispatch.BatchingExecutor$BlockableBatch.run(BatchingExecutor.scala:91)
prisma-database_1 | at akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:40)
prisma-database_1 | at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(ForkJoinExecutorConfigurator.scala:43)
prisma-database_1 | at akka.dispatch.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
prisma-database_1 | at akka.dispatch.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
prisma-database_1 | at akka.dispatch.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
prisma-database_1 | at akka.dispatch.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)
prisma-database_1 |
If I open the Playground and go to the db endpoint, I can see this error in the right tab:
{
"errors": [
{
"requestId": "api:api:cjdbtyq1k001z0116iwuxawk4",
"message": "JsResultException(errors:List((/models(2)/fields(5)/relation/modelBOnDelete,List(JsonValidationError(List(error.path.missing),WrappedArray()))), (/models(2)/fields(6)/relation/modelAOnDelete,List(JsonValidationError(List(error.path.missing),WrappedArray()))), (/relations(0)/modelAOnDelete,List(JsonValidationError(List(error.path.missing),WrappedArray()))), (/models(3)/fields(5)/relation/modelAOnDelete,List(JsonValidationError(List(error.path.missing),WrappedArray()))), (/models(1)/fields(5)/relation/modelBOnDelete,List(JsonValidationError(List(error.path.missing),WrappedArray()))), (/models(1)/fields(4)/relation/modelBOnDelete,List(JsonValidationError(List(error.path.missing),WrappedArray()))), (/relations(0)/modelBOnDelete,List(JsonValidationError(List(error.path.missing),WrappedArray()))), (/models(3)/fields(3)/relation/modelAOnDelete,List(JsonValidationError(List(error.path.missing),WrappedArray()))), (/relations(1)/modelBOnDelete,List(JsonValidationError(List(error.path.missing),WrappedArray()))), (/models(3)/fields(3)/relation/modelBOnDelete,List(JsonValidationError(List(error.path.missing),WrappedArray()))), (/models(4)/fields(3)/relation/modelBOnDelete,List(JsonValidationError(List(error.path.missing),WrappedArray()))), (/relations(1)/modelAOnDelete,List(JsonValidationError(List(error.path.missing),WrappedArray()))), (/models(3)/fields(5)/relation/modelBOnDelete,List(JsonValidationError(List(error.path.missing),WrappedArray()))), (/relations(2)/modelBOnDelete,List(JsonValidationError(List(error.path.missing),WrappedArray()))), (/models(2)/fields(5)/relation/modelAOnDelete,List(JsonValidationError(List(error.path.missing),WrappedArray()))), (/models(0)/fields(6)/relation/modelAOnDelete,List(JsonValidationError(List(error.path.missing),WrappedArray()))), (/models(0)/fields(6)/relation/modelBOnDelete,List(JsonValidationError(List(error.path.missing),WrappedArray()))), (/relations(3)/modelBOnDelete,List(JsonValidationError(List(error.path.missing),WrappedArray()))), (/relations(3)/modelAOnDelete,List(JsonValidationError(List(error.path.missing),WrappedArray()))), (/relations(2)/modelAOnDelete,List(JsonValidationError(List(error.path.missing),WrappedArray()))), (/models(2)/fields(6)/relation/modelBOnDelete,List(JsonValidationError(List(error.path.missing),WrappedArray()))), (/models(4)/fields(3)/relation/modelAOnDelete,List(JsonValidationError(List(error.path.missing),WrappedArray()))), (/models(1)/fields(5)/relation/modelAOnDelete,List(JsonValidationError(List(error.path.missing),WrappedArray()))), (/models(1)/fields(4)/relation/modelAOnDelete,List(JsonValidationError(List(error.path.missing),WrappedArray())))))"
}
]
}
Well, I've run prisma local nuke and now it's working.
It's not the first time I have to do that after updating. I imagine this shouldn't be the solution!
I had the exact same experience.
I have this too:
PS. I did "prisma local nuke" also
{
"code": 3016,
"requestId": "api:api:cjddgdk4900060144206d3gtx",
"error": "Project not found: 'public-coconutbat-841~umovergateway@dev'"
}
=> yarn dev
yarn run v1.3.2
warning package.json: No license field
$ npm-run-all --parallel start playground
warning package.json: No license field
warning package.json: No license field
$ graphql playground
$ dotenv -- nodemon -e ts,graphql -x ts-node src/index.ts
[nodemon] 1.14.12
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: *.*
[nodemon] starting `ts-node src/index.ts`
Server is running on http://localhost:4000
Serving playground at http://localhost:3000/playground
Request to http://192.168.99.101:4466/public-peachleader-607/umovergateway/dev:
query:
mutation ($_data: UserCreateInput!) {
createUser(data: $_data) {
id
email
password
name
}
}
operationName: null
variables:
{
"_data": {
"email": "[email protected]",
"password": "$2a$10$LESZP.2ZSQRuXWL6C.r/G.1BkxA..VoMk44sLnXIJpoJiZ/I2viOK",
"name": "Michel"
}
}
[Network error]: TypeError: results.filter is not a function
Error: results.filter is not a function
at Object.checkResultAndHandleErrors (/Users/micheldiz/hello-world/uMoverGateway/node_modules/graphql-tools/src/stitching/errors.ts:84:7)
at Object.<anonymous> (/Users/micheldiz/hello-world/uMoverGateway/node_modules/graphql-tools/src/stitching/delegateToSchema.ts:97:14)
at step (/Users/micheldiz/hello-world/uMoverGateway/node_modules/graphql-tools/dist/stitching/delegateToSchema.js:40:23)
at Object.next (/Users/micheldiz/hello-world/uMoverGateway/node_modules/graphql-tools/dist/stitching/delegateToSchema.js:21:53)
at fulfilled (/Users/micheldiz/hello-world/uMoverGateway/node_modules/graphql-tools/dist/stitching/delegateToSchema.js:12:58)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:160:7)
I also encountered the problem when performing an ordinary query against the Prisma service. Running the same query within the playground just works. I digged a little deeper and figured that the problem seems to be in the http-link-dataloader: https://github.com/graphcool/http-link-dataloader/blob/171aea40abc76f32acf34d683af61a3f6a619d99/src/BatchedGraphQLClient.ts#L48
Just another debugging information: The Prisma server responds – at least in my case – with an error message. I inspected response._raw body and it is: {"code":3016,"requestId":"api:api:cjddfw4fx000a0186k0mo15wb","error":"Project not found: 'core@dev'"} – Therefore, I guess we should handle error responses from the Prisma service as well. The aspect which is still unclear: Why does the Prisma server has a problem to find my project? 🤔
yeah! I did saw this. I updated my comment with my error.
Ah, found the problem. @emipc, @frankdugan3, @MichelDiz – Please make sure that the service name in database/prisma.yml is also reflected in the PRISMA_ENDPOINT environment variable in .env.
An example:
database/prisma.yml
```yml(path=database/prisma.yml)
service: core
`.env`:
```sh
PRISMA_ENDPOINT="http://localhost:4466/core/dev"
what I have is:
Prisma
# the name for the service (will be part of the service's HTTP endpoint)
service: umovergatewayer
# the cluster and stage the service is deployed to
stage: ${env:PRISMA_STAGE}
# to disable authentication:
# disableAuth: true
secret: ${env:PRISMA_SECRET}
# the file path pointing to your data model
datamodel: datamodel.graphql
# seed your service with initial data based on seed.graphql
seed:
import: seed.graphql
cluster: ${env:PRISMA_CLUSTER}
ENV
PRISMA_STAGE="dev"
PRISMA_ENDPOINT="http://192.168.99.101:4466/public-coconutbat-841/umovergatewayer/dev"
PRISMA_CLUSTER="public-coconutbat-841/local"
PRISMA_SECRET="mysecret123"
APP_SECRET="jwtsecret123"
@MichelDiz: Okay, how does your database/prisma.yml look like?
I did update comment above.
@akoenig Pretty sure your misconfiguration is not related to this issue. My configs always had a consistent service definition. This was an issue that only appeared after an upgrade to a working cluster, then went away with a nuke, just as the OP described.
@MichelDiz Though you are probably working with a development config, it's not a good habit to share secret env variables. ;)
@frankdugan3 It's just a test env. For real I change all of it after xD
@frankdugan3 In my case it had something to do with the misconfiguration. I saw the error within the client. After fixing the configuration everything worked as desired.
@akoenig Did you have working service that you then upgraded, or was this a new service that never worked?
@frankdugan3 It was a new service that never worked.
Thanks @emipc @MichelDiz @frankdugan3 @akoenig @marktani for the awesome detective work on this issue!
The problem was indeed in the recently introduced http-link-dataloader, which didn't handle errors properly.
I fixed it here https://github.com/graphcool/http-link-dataloader/commit/325217908a6b799246b648f16c9170c2d4c5628a
It is published in the prisma-bindings at 1.5.6.
Most helpful comment
Thanks @emipc @MichelDiz @frankdugan3 @akoenig @marktani for the awesome detective work on this issue!
The problem was indeed in the recently introduced
http-link-dataloader, which didn't handle errors properly.I fixed it here https://github.com/graphcool/http-link-dataloader/commit/325217908a6b799246b648f16c9170c2d4c5628a
It is published in the prisma-bindings at
1.5.6.