You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
error: Argument \"filter\" has invalid value {title: \"project1\"}.\nIn field \"title\": Expected \"projectsYamlConnectionTitleQueryString_2\", found not an object.",
my data structure
src/
data/
projects/
-project1.yml
-project2.yml
and so on.
if this cannot work, maybe you can suggest other solution to get data from particular file?
because if I do only projectsYaml i only get the first one, using allProjectsYaml would leave me filtering the list in JS...
Please check https://www.gatsbyjs.org/docs/graphql-reference/#filter - gatsby uses operators for filtering, so it's more flexible - in your case you would probably want to use: query { projectsYaml(title: { eq: "project1"}) - eq meaning title is equal to "project1" - other operators allow for exclussion ne, using regex etc
Filtering doesn't work with yaml files
Based on official GraphQL docs I tried to make a query with gatsby-transformer-yaml
https://www.graph.cool/docs/reference/graphql-api/query-api-nia9nushae#traversing-a-single-node
query { projectsYaml(title: "project1"){ description keywords published } }
this doesn't work, error being
"Argument \"title\" has invalid value \"project1\".\nExpected \"projectsYamlTitleQueryString_2\", found not an object."
also tried this one https://www.graph.cool/docs/reference/graphql-api/query-api-nia9nushae#filtering-by-field
query { allProjectsYaml(filter: { title: "project1" }){ edges{ node{ description keywords date } } } }
error:
Argument \"filter\" has invalid value {title: \"project1\"}.\nIn field \"title\": Expected \"projectsYamlConnectionTitleQueryString_2\", found not an object.",
my data structure
src/
data/
projects/
-project1.yml
-project2.yml
and so on.
if this cannot work, maybe you can suggest other solution to get data from particular file?
because if I do only
projectsYaml
i only get the first one, usingallProjectsYaml
would leave me filtering the list in JS...gatsby info --clipboard
System:
OS: Windows 10
CPU: x64 Intel(R) Core(TM) i5-6300HQ CPU @ 2.30GHz
Binaries:
Node: 10.8.0 - D:\NodeJS\node.EXE
npm: 6.2.0 - D:\NodeJS\npm.CMD
Browsers:
Edge: 42.17134.1.0
npmPackages:
gatsby: ^1.9.277 => 1.9.277
gatsby-image: ^1.0.55 => 1.0.55
gatsby-link: ^1.6.46 => 1.6.46
gatsby-plugin-react-helmet: ^2.0.11 => 2.0.11
gatsby-plugin-sharp: ^1.6.48 => 1.6.48
gatsby-source-filesystem: ^1.5.39 => 1.5.39
gatsby-transformer-json: ^1.0.20 => 1.0.20
gatsby-transformer-sharp: ^1.6.27 => 1.6.27
gatsby-transformer-yaml: ^1.5.18 => 1.5.18
error The system cannot find the path specified.
Error: The system cannot find the path specified.
envinfo.js:1 Function.e.exports.sync
[npm]/[gatsby-cli]/[envinfo]/dist/envinfo.js:1:7778
envinfo.js:1 Object.copySync
[npm]/[gatsby-cli]/[envinfo]/dist/envinfo.js:1:104976
envinfo.js:1 Object.t.writeSync.e [as writeSync]
[npm]/[gatsby-cli]/[envinfo]/dist/envinfo.js:1:123499
envinfo.js:1
[npm]/[gatsby-cli]/[envinfo]/dist/envinfo.js:1:124274
envinfo.js:1 Promise.all.then.e
[npm]/[gatsby-cli]/[envinfo]/dist/envinfo.js:1:124289
util.js:16 tryCatcher
[npm]/[gatsby-cli]/[bluebird]/js/release/util.js:16:23
promise.js:512 Promise._settlePromiseFromHandler
[npm]/[gatsby-cli]/[bluebird]/js/release/promise.js:512:31
promise.js:569 Promise._settlePromise
[npm]/[gatsby-cli]/[bluebird]/js/release/promise.js:569:18
promise.js:614 Promise._settlePromise0
[npm]/[gatsby-cli]/[bluebird]/js/release/promise.js:614:10
promise.js:693 Promise._settlePromises
[npm]/[gatsby-cli]/[bluebird]/js/release/promise.js:693:18
promise.js:638 Promise._fulfill
[npm]/[gatsby-cli]/[bluebird]/js/release/promise.js:638:18
promise_array.js:126 PromiseArray._resolve
[npm]/[gatsby-cli]/[bluebird]/js/release/promise_array.js:126:19
promise_array.js:144 PromiseArray._promiseFulfilled
[npm]/[gatsby-cli]/[bluebird]/js/release/promise_array.js:144:14
promise.js:574 Promise._settlePromise
[npm]/[gatsby-cli]/[bluebird]/js/release/promise.js:574:26
promise.js:614 Promise._settlePromise0
[npm]/[gatsby-cli]/[bluebird]/js/release/promise.js:614:10
promise.js:693 Promise._settlePromises
[npm]/[gatsby-cli]/[bluebird]/js/release/promise.js:693:18
error UNHANDLED REJECTION
Error: The system cannot find the path specified.
envinfo.js:1 Function.e.exports.sync
[npm]/[gatsby-cli]/[envinfo]/dist/envinfo.js:1:7778
envinfo.js:1 Object.copySync
[npm]/[gatsby-cli]/[envinfo]/dist/envinfo.js:1:104976
envinfo.js:1 Object.t.writeSync.e [as writeSync]
[npm]/[gatsby-cli]/[envinfo]/dist/envinfo.js:1:123499
envinfo.js:1
[npm]/[gatsby-cli]/[envinfo]/dist/envinfo.js:1:124274
envinfo.js:1 Promise.all.then.e
[npm]/[gatsby-cli]/[envinfo]/dist/envinfo.js:1:124289
util.js:16 tryCatcher
[npm]/[gatsby-cli]/[bluebird]/js/release/util.js:16:23
promise.js:512 Promise._settlePromiseFromHandler
[npm]/[gatsby-cli]/[bluebird]/js/release/promise.js:512:31
promise.js:569 Promise._settlePromise
[npm]/[gatsby-cli]/[bluebird]/js/release/promise.js:569:18
promise.js:614 Promise._settlePromise0
[npm]/[gatsby-cli]/[bluebird]/js/release/promise.js:614:10
promise.js:693 Promise._settlePromises
[npm]/[gatsby-cli]/[bluebird]/js/release/promise.js:693:18
promise.js:638 Promise._fulfill
[npm]/[gatsby-cli]/[bluebird]/js/release/promise.js:638:18
promise_array.js:126 PromiseArray._resolve
[npm]/[gatsby-cli]/[bluebird]/js/release/promise_array.js:126:19
promise_array.js:144 PromiseArray._promiseFulfilled
[npm]/[gatsby-cli]/[bluebird]/js/release/promise_array.js:144:14
promise.js:574 Promise._settlePromise
[npm]/[gatsby-cli]/[bluebird]/js/release/promise.js:574:26
promise.js:614 Promise._settlePromise0
[npm]/[gatsby-cli]/[bluebird]/js/release/promise.js:614:10
promise.js:693 Promise._settlePromises
[npm]/[gatsby-cli]/[bluebird]/js/release/promise.js:693:18
(browsers are wrong, i have opera, chrome, and firefox, but don't think this is relevant.
gatsby-config.js
:module.exports = { siteMetadata: { title: 'xxx', }, plugins: [ 'gatsby-plugin-react-helmet', 'gatsby-transformer-json', 'gatsby-transformer-sharp', 'gatsby-transformer-yaml', 'gatsby-plugin-sharp', { resolve: 'gatsby-source-filesystem', options: { name: 'data', path: './src/data', }, }, { resolve: 'gatsby-source-filesystem', options: { name: 'projects', path: './src/data/projects', }, }, { resolve: 'gatsby-source-filesystem', options: { name: 'img', path: './src/assets/images', }, }, ], }
package.json
: N/Agatsby-node.js
: N/Agatsby-browser.js
: N/Agatsby-ssr.js
: N/AThe text was updated successfully, but these errors were encountered: