Couldn't add device (AWS lambda)

I was trying to integrate Smartthings with AWS lambda and AWS IOT core

  1. Created a AWS lambda in N.Virginia and gave permission to smartthings.
  2. Configured AuthO(also gave samrtthings callback URLs) account for OAuth authentication.
  3. Went to developer workspace and gave the required details.
  4. Also created a device profile.

In the smartthings app (My testing devices) the doesnt even redirect to authO page.It just shows the following error.please help.

error

tagging @nayelyz

1 Like

Welcome, @Rohit007! There are a couple of things I’d like to confirm:

  1. You’re working with an ST Schema integration
  2. Does your OAuth server receive the request from SmartThings when you select the device?

Yes I am using cloud connector.I am using authO for authentication control. And has no problem from authO side.

Ok, so, since the Authentication flow doesn’t seem to initialize. Take a look at the OAuth servers of the samples below. They have been tested and the OAuth process is successful, within them, you can see the process flow and verify if your integration complies with it.

I tried with the given OAuth server and AWS lambda. The same Coudnt find device error occured.
But with the given Oauth and Webhook . It started the authentication process.But i got an error even there.(404)


Here are the Oauth logs

And workspace screenshot

Make sure you have the same configuration you put at the Device Cloud Credentials of the ST Schema connector (Developer Workspace) and the .env file of the OAuth server (in Glitch)

Those configurations are also printed at the logs, so you can verify if they match:
image

Sorry for late reply.
Yes the OAuth server is working. I am trying with AWS lambda now. And ran into this error
Capture4

Also the authO server has the same config as glitches server but is not redirecting. Then where are things going worng?

Hi, sorry for the delay.

So, this means using a WebHook project, the installation was successful?

Ok, to avoid this issue, make sure you:

  1. Have your Lambda function in the correct region (us-east-1, ap-northeast-1 or eu-west-1)
  2. You configured correctly your AWS CLI (the correct key and region selected)
  3. You provided the permissions to your Lambda function (using the correct AWS CLI profile and principal value)
aws lambda add-permission --function-name functionName --profile profileName --principal 148790070172 --statement-id smartthings --action lambda:InvokeFunction
  1. The configuration and code of your Lambda function are correct
    a. The project must have the node_modules > st-schema directory.
    b. In the runtime configuration, you need to see that the handler info matches your file. Eg. if your file is named index.js, index.handler it’s correct.