noxify / gridsome-plugin-remote-image

simple plugin to download remote images in gridsome
MIT License
14 stars 16 forks source link

Cannot read property 'findNode' of undefined #28

Closed yulafezmesi closed 3 years ago

yulafezmesi commented 3 years ago

When tried to implement Metadata type, I'm getting this error. Is there any way to implement core Metadata type without a collection?

Cannot read property 'findNode' of undefined

 {
      use: '@noxify/gridsome-plugin-remote-image',
      options: {
        typeName: 'Metadata',
        sourceField: 'image',
        targetField: 'imageDownloaded',
        targetPath: './src/assets/remoteImages',
      },
    },
madex1 commented 3 years ago

i have the same problem

TypeError: Cannot read property 'findNode' of undefined
    at ImageDownloader.getFieldType ...

when i'm using @noxify/gridsome-plugin-remote-image with @gridsome/source-graphql source plugin.

nodeCollection is undefined here:

getFieldType(api, options) {

        const nodeCollection = api._app.store.getCollection(options.typeName);

when this function is called here:

api.createSchema(({ addSchemaTypes }) => {
            const fieldType = this.getFieldType(api, options);
            this.generateSchemaType(addSchemaTypes, fieldType);
        });

it seems like collections are not loaded when this code is running :(

i've got typeName value from localhost:8080/__explore, so it should work as i suggest :)

Can you help me?

noxify commented 3 years ago

Hi,

sorry for the delay.

Currently the plugin doesn't work with the graphql source.

The problem is, that the external graphql source isn't imported into the gridsome graphql.

Currently I have no glue how to solve it.

madex1 commented 3 years ago

Ok, thanks. Please add this information to docs

noxify commented 3 years ago

Docs updated :)

https://github.com/noxify/webstone.info/blob/master/content/documentation/gridsome-plugin-remote-image/index.md#graphql-data-source

Result: https://webstone.info/documentation/gridsome-plugin-remote-image/