我正在尝试借助以下代码和库读取我在 shopify 后端上传的文件:
const shopify = new Shopify({
shopName: process.env.STORE_NAME,
apiKey: process.env.API_KEY,
password: process.env.STORE_PASSWORD,
});
const query = `{
files {
edges {
node {
alt
}
}
}
}`;
shopify
.graphql(query)
.then((files) => console.log(files))
.catch((err) => console.error(err));
但我遇到了这个错误
Error: Field 'files' doesn't exist on type 'QueryRoot'
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
locations: [ { line: 2, column: 7 } ],
path: [ 'query', 'files' ],
extensions: { code: 'undefinedField', typeName: 'QueryRoot', fieldName: 'files' },
response: <ref *1> PassThrough
}
请如果有人可以帮助我,我将非常感激。谢谢!