Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid options provided to ApolloServer: costAnalysis is not a function #10

Closed
ShigeruNakagaki opened this issue Apr 25, 2018 · 2 comments

Comments

@ShigeruNakagaki
Copy link

I'm trying to use graphql-cost-analysis. but it just said costAnalysis is not a function.
I can not show you entire code. but it's like this.

const { graphqlExpress } = require('graphql-server-express');
const costAnalysis = require('graphql-cost-analysis')
...
      graphqlExpress(req => {
        return {
          schema,
          rootValue: null,
          validationRules: [
            costAnalysis({
              variables: req.body.variables,
              maximumCost: 10
            }),
          ],
        }
      })
...

and the result of console.log(costAnalysis) is like this.

{ default: [Function: createCostAnalysis] }

What am I missing?

thanks

@mxstbr
Copy link
Contributor

mxstbr commented Apr 25, 2018

const costAnalysis = require('graphql-cost-analysis').default

@ShigeruNakagaki
Copy link
Author

ahh, thank you!

I tried maximumCost: 1. the result was not what I expected.
It seems I need to study more about the configuration.

thank you again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants