dillonkearns / elm-graphql

Autogenerate type-safe GraphQL queries in Elm.

Home Page:https://package.elm-lang.org/packages/dillonkearns/elm-graphql/latest

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error running generator

atomkirk opened this issue · comments

I'm getting this error running the generator.

> our-elm-spa-app@1.0.0 schema /Users/adamkirk/Work/mt/markable/web-elm
> elm-graphql http://localhost:4000/v1/graphql --base Markable --scalar-codecs ScalarCodecs

Fetching GraphQL schema...
Generating files...
(node:24203) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'writeFile' of undefined
    at /Users/adamkirk/Work/mt/markable/web-elm/node_modules/@dillonkearns/elm-graphql/dist/bundle.js:48718:24
    at Array.map (<anonymous>)
    at writeGeneratedFiles (/Users/adamkirk/Work/mt/markable/web-elm/node_modules/@dillonkearns/elm-graphql/dist/bundle.js:48714:40)
    at Array.<anonymous> (/Users/adamkirk/Work/mt/markable/web-elm/node_modules/@dillonkearns/elm-graphql/dist/bundle.js:48671:27)
    at step (/Users/adamkirk/Work/mt/markable/web-elm/node_modules/@dillonkearns/elm-graphql/dist/bundle.js:48526:17)
    at Object.next (/Users/adamkirk/Work/mt/markable/web-elm/node_modules/@dillonkearns/elm-graphql/dist/bundle.js:48457:14)
    at /Users/adamkirk/Work/mt/markable/web-elm/node_modules/@dillonkearns/elm-graphql/dist/bundle.js:48429:67
    at new Promise (<anonymous>)
    at __awaiter (/Users/adamkirk/Work/mt/markable/web-elm/node_modules/@dillonkearns/elm-graphql/dist/bundle.js:48408:10)
    at Array.<anonymous> (/Users/adamkirk/Work/mt/markable/web-elm/node_modules/@dillonkearns/elm-graphql/dist/bundle.js:48663:12)
(node:24203) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:24203) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

I'm happy to provide my graphql schema so you can reproduce locally. Can you remind me how to provide that in a way that's convenient for you? :)

ok weird, if I run it directly:

elm-graphql http://localhost:4000/v1/graphql --base Markable --scalar-codecs ScalarCodecs

then it works fine

But if I run npm run schema which has a script with the same content, then it fails. So I assume some node package is screwed up? Any idea whats going on?

I'm going to close this cause i'm pretty sure its not a problem with the lib. I'm wondering if running it through npm is using an old version? 🤔 If you read this and have a suggestion let me know