ardatan/graphql-import

Error when using with amazon lambda

Closed this issue · 3 comments

I get this in logs when I try to use it with amazon lambda:

module initialization error: Error
at Error (native)
at Object.fs.openSync (fs.js:641:18)
at Object.fs.readFileSync (fs.js:509:33)
at read (/var/task/node_modules/graphql-import/dist/index.js:10:19)
at importSchema (/var/task/node_modules/graphql-import/dist/index.js:57:15)
at Object.<anonymous> (/var/task/handler.js:176:48)
at __webpack_require__ (/var/task/handler.js:20:30)
at Object.<anonymous> (/var/task/handler.js:91:15)
at __webpack_require__ (/var/task/handler.js:20:30)
at /var/task/handler.js:63:18

Can you share your repo url + ideally the packaged zip file? Also, can you reproduce the problem with the packaged zipfile in a lambda docker container?

Found the issue. Wasn't graphql-import.
In the default webpack config of serverless graphql example it does not copy automatically the .graphql files into source folder. I used copy-webpack-plugin to do the trick.

    new CopyWebpackPlugin([
      {
        from: 'src/types/',
        to: 'types'
      },
      {
        from: 'src/schema.graphql',
        to: ''
      }
    ], {}),```

Would be great if there was a webpack loader that works with graphql-import.