Defender-relay-client error with nextjs, "Can't resolve aws-sdk/clients/lambda"

I face issues with using the defender relay client npm package when attempting to setup an ethers signer with class DefenderRelayProvider due to a compile issue in nextjs:

the error says

error - ./node_modules/defender-base-client/lib/autotask/index.js:7:0
Module not found: Can't resolve 'aws-sdk/clients/lambda'

Import trace for requested module:

I've been trying to debug this for hours now. If anyone could help, it would be greatly appreciated.

1 Like

Hey @Darlington02,

Unfortunately, this error seems to be related to browser usage, which is not intended for the defender-relay-client as stated in the FAQ.

If you're using it on Next.js within the API capabilities it offers, it could be fine, otherwise, it's exposing sensitive data.

In any case, it draws my attention that the error is for AWS's lambda, which is only configured in the defender-autotask-client, so I'm curious which credentials are you passing to new DefenderRelayProvider .

Hope this helps!

1 Like

Thanks for coming through @ernestognw

I already fixed the issue yesterday by using a defender autotask, turns out defender relayers where not meant to run on browsers but within a node environment so as not to expose sensitive data like you said.

1 Like