Server error 502: Encryption/trust can only be configured either through URL or config, not both

I’m getting a new website up and running for the first time with netlify and running in to a server-side issue. The react front end works fine, but whenever it makes a server call I get a 502 error that states:

Encryption/trust can only be configured either through URL or config, not both

I have a lambda function set up that is running an Apollo GraphQL endpoint. The endpoint is running at https://www.mems.life/.netlify/functions/graphql and I have a re-direct configured in my netlify.toml file to redirect from /graphql to /.netlify/functions/graphql.

When my react front end makes a request to the server, these are the headers that are sent:

As you can see, I’m calling the /graphql endpoint that should redirect to /.netlify/functions/graphql where my function is running but I can’t figure out why I’m getting the 502 error about encryption.

I’ve taken a look at the logs and I’m getting the following:

Error
3:38:50 PM: 2020-08-10T14:38:50.953Z	undefined	ERROR	Uncaught Exception 	{"errorType":"Error","errorMessage":"Encryption/trust can only be configured either through URL or config, not both","stack":["Error: Encryption/trust can only be configured either through URL or config, not both","    at Object.driver (/var/task/src/node_modules/neo4j-driver/lib/index.js:291:13)","    at Object.<anonymous> (/var/task/src/build/functions/graphql/graphql.js:21:22)","    at Module._compile (internal/modules/cjs/loader.js:1138:30)","    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)","    at Module.load (internal/modules/cjs/loader.js:986:32)","    at Function.Module._load (internal/modules/cjs/loader.js:879:14)","    at Module.require (internal/modules/cjs/loader.js:1026:19)","    at require (internal/modules/cjs/helpers.js:72:18)","    at Object.<anonymous> (/var/task/graphql.js:1:18)","    at Module._compile (internal/modules/cjs/loader.js:1138:30)"]}
3:38:51 PM: 2020-08-10T14:38:51.973Z	undefined	ERROR	Uncaught Exception 	{"errorType":"Error","errorMessage":"Encryption/trust can only be configured either through URL or config, not both","stack":["Error: Encryption/trust can only be configured either through URL or config, not both","    at Object.driver (/var/task/src/node_modules/neo4j-driver/lib/index.js:291:13)","    at Object.<anonymous> (/var/task/src/build/functions/graphql/graphql.js:21:22)","    at Module._compile (internal/modules/cjs/loader.js:1138:30)","    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)","    at Module.load (internal/modules/cjs/loader.js:986:32)","    at Function.Module._load (internal/modules/cjs/loader.js:879:14)","    at Module.require (internal/modules/cjs/loader.js:1026:19)","    at require (internal/modules/cjs/helpers.js:72:18)","    at Object.<anonymous> (/var/task/graphql.js:1:18)","    at Module._compile (internal/modules/cjs/loader.js:1138:30)"]}
3:38:52 PM: 2020-08-10T14:38:52.488Z	undefined	ERROR	Uncaught Exception 	{"errorType":"Error","errorMessage":"Encryption/trust can only be configured either through URL or config, not both","stack":["Error: Encryption/trust can only be configured either through URL or config, not both","    at Object.driver (/var/task/src/node_modules/neo4j-driver/lib/index.js:291:13)","    at Object.<anonymous> (/var/task/src/build/functions/graphql/graphql.js:21:22)","    at Module._compile (internal/modules/cjs/loader.js:1138:30)","    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)","    at Module.load (internal/modules/cjs/loader.js:986:32)","    at Function.Module._load (internal/modules/cjs/loader.js:879:14)","    at Module.require (internal/modules/cjs/loader.js:1026:19)","    at require (internal/modules/cjs/helpers.js:72:18)","    at Object.<anonymous> (/var/task/graphql.js:1:18)","    at Module._compile (internal/modules/cjs/loader.js:1138:30)"]}
3:38:52 PM: Duration: 1519.27 ms	Memory Usage: 45 MB	
3:38:52 PM: Unknown application error occurred

That error is coming from your code - you should see it when running locally as well. Do you?

I assert that it is likely not related to the redirect - I see the same output at

https://www.mems.life/.netlify/functions/graphql

and

https://www.mems.life/graphql

…so that at least isn’t related to the problem.

Thank you so much for getting back to me. I’m not seeing this in my local code - that all runs as expected. I’m glad you can see the same output at each URL, but that does make the problem more confusing!

Hey @Sean,
That error looks like it’s coming from the neo4j package:

I’m not familiar with the config details there, but maybe you are? :slight_smile:

Sharing some docs as well in case they’re helpful:
https://neo4j.com/docs/driver-manual/4.1/client-applications/#driver-connection-uris

1 Like

Thanks Jen, this is really useful - I’ll do some digging in the config files!

Sean

1 Like

@Sean did you get to the bottom of it?

No, not yet - still digging!