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

Internal error when hitting endpoint #17

Open
jrrbru opened this issue Feb 3, 2020 · 4 comments
Open

Internal error when hitting endpoint #17

jrrbru opened this issue Feb 3, 2020 · 4 comments

Comments

@jrrbru
Copy link

jrrbru commented Feb 3, 2020

I'm trying to get a manually-configured Lambda up using this example. When I hit the gateway API endpoint, I get this error in the CloudWatch logs:

 "TypeError: Cannot read property 'indexOf' of undefined",
        "    at Function.getFileName (webpack:///./node_modules/bindings/bindings.js?:178:16)",
        "    at bindings (webpack:///./node_modules/bindings/bindings.js?:82:48)",
        "    at Object.eval (webpack:///./node_modules/libpq/index.js?:1:147)",
        "    at eval (webpack:///./node_modules/libpq/index.js?:361:30)",
        "    at Object../node_modules/libpq/index.js (/var/task/index.js:3785:1)",
        "    at __webpack_require__ (/var/task/index.js:20:30)",
        "    at eval (webpack:///./node_modules/pg-native/index.js?:1:13)",
        "    at Object../node_modules/pg-native/index.js (/var/task/index.js:5848:1)",
        "    at __webpack_require__ (/var/task/index.js:20:30)",
        "    at eval (webpack:///./node_modules/pg/lib/native/client.js?:11:14)"

My postgraphileOptions.js are as follows:

exports.options = {
  dynamicJson: true,
  cors: true,
  graphiql: false,
  graphqlRoute: '/graphql',
  externalUrlBase: `/${process.env.AWS_STAGE}`,

  // If consuming JWT:
 // jwtSecret: process.env.JWT_SECRET || String(Math.random()),
  // If generating JWT:
  //jwtPgTypeIdentifier: process.env.JWT_PG_TYPE_IDENTIFIER,

  /* If you want to enable GraphiQL, you must use `externalUrlBase` so PostGraphile
   * knows where to tell the browser to find the assets.  Doing this is
   * strongly discouraged, you should use an external GraphQL client instead.

    graphiql: true,
    enhanceGraphiql: true,
    graphqlRoute: '/',
    graphiqlRoute: '/graphiql',
  */
};

I'd appreciate any help anyone could give.

@benjie
Copy link
Member

benjie commented Feb 5, 2020

Are you using yarn or npm? It might be worth using yarn and using this specific lockfile just in case one of the dependencies broke something.

@benjie
Copy link
Member

benjie commented Feb 5, 2020

Also you seem to be using pg-native; I recommend against using pg-native - it's normally slower than the JS version and harder to trace.

@jrrbru
Copy link
Author

jrrbru commented Feb 5, 2020

Hi Benjie. Thanks for getting back to me. I'm using yarn so it should be using the lockfile in the repo.

How do I tell it not to use pg-native? I don't think I changed anything around that dependency.

Finally, would this have anything to do with building the lambda on Windows?

@benjie
Copy link
Member

benjie commented Feb 5, 2020

I'm afraid I don't know the answers to your questions. It definitely worked last time I tried it, but that was months ago.

We have this which "forces native":

'process.env.NODE_PG_FORCE_NATIVE': JSON.stringify('1'),

But that should be overridden by this, which uses the JS client only:

new webpack.NormalModuleReplacementPlugin(/pg\/lib\/native\/index\.js$/, '../client.js'),

It looks, however, like your one is referencing pg/lib/native/client.js rather than pg/lib/native/index.js. Not sure if this is relevant.

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