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

iotdataplane - Resource not found #493

Closed
eicca opened this issue Jan 8, 2016 · 4 comments
Closed

iotdataplane - Resource not found #493

eicca opened this issue Jan 8, 2016 · 4 comments
Assignees
Labels
service-api This issue is due to a problem in a service API, not the SDK implementation.

Comments

@eicca
Copy link

eicca commented Jan 8, 2016

I'm trying following example, basically almost identical to one from examples_test.go:

var (
    svcSession = session.New(&aws.Config{
        Region: aws.String("eu-west-1"),
    })
    svc = iotdataplane.New(svcSession, &aws.Config{
        Endpoint: aws.String("data.iot.eu-west-1.amazonaws.com"),
    })
)

func main() {
    params := &iotdataplane.GetThingShadowInput{
        ThingName: aws.String("rPi"),
    }

    resp, err := svc.GetThingShadow(params)
    if err != nil {
        fmt.Println(err)
        return
    }
    fmt.Println(resp.Payload)
}

This code returns:

ResourceNotFoundException: Not Found
    status code: 404, request id: 88db4e32-9a92-43f8-aea5-4093a24639e2

(NOTE: I tried to use both data and our custom iot subdomains)

I can successfully fetch this device both with aws-cli and nodejs sdk:

var AWS = require('aws-sdk');
var endpoint = "data.iot.eu-west-1.amazonaws.com"

var iotdata = new AWS.IotData({
    endpoint: endpoint,
    region: "eu-west-1"
});

var params = {
    thingName: 'rPi'
};

iotdata.getThingShadow(params, function (err, data) {
    if (err) console.log(err, err.stack); // an error occurred
    else     console.log(data);           // successful response
});

This example successfully returns data about the shadow.

I checked request logs and they look almost identical. These are logs for go sdk: https://gist.github.com/eicca/d7cb7fb592bf329eacbb

iot package works fine and I can get attributes of this shadow with iot package.

Could you give a hint, what might be wrong here? Thanks.

@jasdel jasdel added the bug This issue is a bug. label Jan 8, 2016
@jasdel
Copy link
Contributor

jasdel commented Jan 8, 2016

Thanks for reporting this issue @eicca. I was able to reproduce the issue you're seeing. I'm taking a look into what is going on here and update this issue when I have a workaround or solution.

@jasdel jasdel self-assigned this Jan 8, 2016
@jasdel
Copy link
Contributor

jasdel commented Jan 14, 2016

@eicca I've been working with the service team. We're investigating and working on a fix for this issue and will post and update when we have a fix together and available.

@jasdel jasdel added the service-api This issue is due to a problem in a service API, not the SDK implementation. label Jan 15, 2016
@jasdel jasdel removed the bug This issue is a bug. label Feb 9, 2016
@brianfaull
Copy link

The iotdataplane.GetThingShadow() seems to be working now, but I only did a quick test. Is this issue closed, or are there remaining functional issues or testing to be completed? It bugs me (just a little bit :) every time I see my MQTT-based workaround scroll by in logs... but I don't want to be too hasty if it's not ready for primetime! Thank you.

@jasdel
Copy link
Contributor

jasdel commented Mar 14, 2016

Hi @brianfaull thanks for contacting us. I've verified IoT data is now working as expected. The issue causing the SDK to be unable to communicate correctly with the IoT data service has been corrected. The following script exercies this.

package main

import (
    "fmt"
    "os"

    "github.com/aws/aws-sdk-go/aws"
    "github.com/aws/aws-sdk-go/aws/session"
    "github.com/aws/aws-sdk-go/service/iot"
    "github.com/aws/aws-sdk-go/service/iotdataplane"
)

// Usage: AWS_REGION=<region> AWS_PROFILE=<profile> go run iotdata.go <thingname> <topic>
func main() {
    if len(os.Args) != 3 {
        fmt.Println("Usage: AWS_REGION=<region> AWS_PROFILE=<profile> go run iotdata.go <thingname> <topic>")
        return
    }

    sess := session.New(aws.NewConfig().
        WithLogLevel(aws.LogDebugWithHTTPBody))

    iotSvc := iot.New(sess)
    res, err := iotSvc.DescribeEndpoint(&iot.DescribeEndpointInput{})
    if err != nil {
        fmt.Println("describe endpoint err", err)
        return
    }
    fmt.Println("Endpoint:", res)

    svc := iotdataplane.New(sess, &aws.Config{Endpoint: res.EndpointAddress})
    result, err := svc.Publish(&iotdataplane.PublishInput{
        Payload: []byte("my payload"),
        Topic:   &os.Args[2],
    })
    fmt.Println("publish", result, err)

    shadow, err := svc.GetThingShadow(&iotdataplane.GetThingShadowInput{
        ThingName: &os.Args[1],
    })
    fmt.Println("shadow", shadow, err)
}

@jasdel jasdel closed this as completed Mar 14, 2016
skotambkar pushed a commit to skotambkar/aws-sdk-go that referenced this issue May 20, 2021
…d KeyConditionBuilder (aws#494)

Adds IsSet method to the ConditionBuilder and KeyConditionBuilder types. This methods makes it easier to discover if the condition builders have any conditions added to them.

Implements aws#493.
skotambkar pushed a commit to skotambkar/aws-sdk-go that referenced this issue May 20, 2021
Breaking Change
---
* `aws/endpoints`: Several functions and types have been removed
  * Removes `DecodeModel` and `DecodeModelOptions` from the package ([aws#509](aws/aws-sdk-go-v2#509))
  * Remove Region Constants, Partition Constants, and types use for exploring the endpoint data model ([aws#512](aws/aws-sdk-go-v2#512))
* `service/s3/s3crypto`: Package and associated encryption/decryption clients have been removed from the SDK ([aws#511](aws/aws-sdk-go-v2#511))
* `aws/external`: Removes several export constants and types ([aws#508](aws/aws-sdk-go-v2#508))
  * No longer exports AWS environment constants used by the external environment configuration loader
  * `DefaultSharedConfigProfile` is now defined an exported constant
* `aws`: `ErrMissingRegion`, `ErrMissingEndpoint`, `ErrStaticCredentialsEmpty` are now concrete error types ([aws#510](aws/aws-sdk-go-v2#510))

Services
---
* Synced the V2 SDK with latest AWS service API definitions.

SDK Features
---
* `aws/signer/v4`: New methods `SignHTTP` and `PresignHTTP` have been added ([aws#519](aws/aws-sdk-go-v2#519))
  * `SignHTTP` replaces `Sign`, and usage of `Sign` should be migrated before it's removal at a later date
  * `PresignHTTP` replaces `Presign`, and usage of `Presign` should be migrated before it's removal at a later date
  * `DisableRequestBodyOverwrite` and `UnsignedPayload` are now deprecated options and have no effect on `SignHTTP` or `PresignHTTP`. These options will be removed at a later date.
* `aws/external`: Add Support for setting a default fallback region and resolving region from EC2 IMDS ([aws#523](aws/aws-sdk-go-v2#523))
  * `WithDefaultRegion` helper has been added which can be passed to `LoadDefaultAWSConfig`
    * This helper can be used to configure a default fallback region in the event a region fails to be resolved from other sources
  * Support has been added to resolve region using EC2 IMDS when available
    * The IMDS region will be used if region as not found configured in either the shared config or the process environment.
  * Fixes [aws#244](aws/aws-sdk-go-v2#244)
  * Fixes [aws#515](aws/aws-sdk-go-v2#515)

SDK Enhancements
---
* `service/dynamodb/expression`: Add IsSet helper for ConditionBuilder and KeyConditionBuilder ([aws#494](aws/aws-sdk-go-v2#494))
  * Adds a IsSet helper for ConditionBuilder and KeyConditionBuilder to make it easier to determine if the condition builders have any conditions added to them.
  * Implements [aws#493](aws/aws-sdk-go-v2#493).
* `internal/ini`: Normalize Section keys to lowercase ([aws#495](aws/aws-sdk-go-v2#495))
  * Update's SDK's ini utility to store all keys as lowercase. This brings the SDK inline with the AWS CLI's behavior.


SDK Bugs
---
* `internal/sdk`: Fix SDK's UUID utility to handle partial read ([aws#536](aws/aws-sdk-go-v2#536))
  * Fixes the SDK's UUID utility to correctly handle partial reads from its crypto rand source. This error was sometimes causing the SDK's InvocationID value to fail to be obtained, due to a partial read from crypto.Rand.
  * Fix [aws#534](aws/aws-sdk-go-v2#534)
* `aws/defaults`: Fix request metadata headers causing signature errors ([aws#536](aws/aws-sdk-go-v2#536))
    * Fixes the SDK's adding the request metadata headers in the wrong location within the request handler stack. This created a situation where a request that was retried would sign the new attempt using the old value of the header. The header value would then be changed before sending the request.
    * Fix [aws#533](aws/aws-sdk-go-v2#533)
    * Fix [aws#521](aws/aws-sdk-go-v2#521)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
service-api This issue is due to a problem in a service API, not the SDK implementation.
Projects
None yet
Development

No branches or pull requests

3 participants