TypeError: definitions.trim is not a function
See original GitHub issueBug report
when running against the latest release (5.3.5) against the latest release of graphql(1.17.4) yoga. I receive the following error.
If I rollback yoga to (1.17.1) the error disappears. Seems to be caused by yoga upgrading their version of graphql-middleware from 3.0.1 to 3.0.2.
TypeError: definitions.trim is not a function
at parseFragmentToInlineFragment (/Users/rorykelly/Desktop/Rockspin/CuratedServer/node_modules/graphql-middleware/src/fragments.ts:85:21)
at /Users/rorykelly/Desktop/Rockspin/CuratedServer/node_modules/graphql-middleware/src/fragments.ts:41:24
at Array.map (<anonymous>)
at Object.extractFragmentReplacements (/Users/rorykelly/Desktop/Rockspin/CuratedServer/node_modules/graphql-middleware/src/fragments.ts:40:6)
at addMiddlewareToSchema (/Users/rorykelly/Desktop/Rockspin/CuratedServer/node_modules/graphql-middleware/src/middleware.ts:40:32)
at normalisedMiddlewares.reduceRight.schema (/Users/rorykelly/Desktop/Rockspin/CuratedServer/node_modules/graphql-middleware/src/middleware.ts:86:13)
at Array.reduceRight (<anonymous>)
at applyMiddlewareWithOptions (/Users/rorykelly/Desktop/Rockspin/CuratedServer/node_modules/graphql-middleware/src/middleware.ts:78:77)
at applyMiddleware (/Users/rorykelly/Desktop/Rockspin/CuratedServer/node_modules/graphql-middleware/src/middleware.ts:129:36)
at new GraphQLServer (/Users/rorykelly/Desktop/Rockspin/CuratedServer/node_modules/graphql-yoga/src/index.ts:137:13)
To Reproduce
Expected behavior
Yoga Server should start.
Actual behaviour
Receive above error.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:4
- Comments:11
Top Results From Across the Web
javascript - .trim() is not a function - Stack Overflow
you should be getting TypeError: array. · The split() method splits a String object into an array of strings by separating the string...
Read more >[Solved] TypeError: trim is not a function - ItsJavaScript
The TypeError: trim is not a function occurs if we call a trim() method on the value that is not of a type...
Read more >TypeError: definitions.trim is not a function · Issue #361 - GitHub
Bug report when running against the latest release (5.3.5) against the latest release of graphql(1.17.4) yoga. I receive the following error ...
Read more >definitions.trim is not a function when using gql tag with ...
From where you're importing gql could you please share this information? You can either use: import { gql } from 'apollo-boost' // OR...
Read more >d.trim() is not a function - datetime-moment.js - DataTables
Link to test case: N/A Debugger code (debug.datatables.net): N/A Error messages shown: Uncaught TypeError: d.trim is not a function at Array ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
As suggested by @RoryKelly the issue is caused by
graphql-middleware
update to3.0.2
, a dependency ofgraphql-yoga 1.17.2+
It can be corrected by requiring graphql-middleware 3.0.1 as follows. Only works with
yarn
,npm install
does not processresolutions
package.json
See graphql-middleware #198
graphql-yoga latest (
1.18.1
) appears to work as expected with graphql-midleware 3.0.1https://github.com/prisma/photonjs/tree/master/examples/typescript/graphql-auth