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

IoT - shadow error #6

Closed
ulutomaz opened this issue Apr 20, 2018 · 2 comments
Closed

IoT - shadow error #6

ulutomaz opened this issue Apr 20, 2018 · 2 comments

Comments

@ulutomaz
Copy link

ulutomaz commented Apr 20, 2018

Hi,

I am trying to get through the configuration of this package. To get to the point where I would be able to get and update the devices shadow, through the REST API. For easier development, I added my self a permission where I has access to all iot:* resources.

In my config/dev.exs I have a confguration like in Readme.md

iex> client = %AWS.Client{access_key_id: "<access-key-id>",
                     secret_access_key: "<secret-access-key>",
                     region: "us-east-1",
                     endpoint: "amazonaws.com"}

Then, if i issue a code to initialize this client, I get back response like

%AWS.Client{access_key_id: "<secret>", endpoint: "amazonaws.com",
 port: "443", proto: "https", region: "eu-west-1",
 secret_access_key: "<secret>", service: nil}

I can even issue a call to list all the things. I get back the result with all the things listed.

BUT: When I want to get back the shadow of one of the devices, I get back the error.

I call the shadow with

AWS.IoT.DataPlane.get_thing_shadow(Shadow.Client.init_client(), "<thingName>")

init_client is just my function... nothing special.
And I get back {:error, "Not Found"} though if I go and search it over the web console I can see it there.

@fermuch
Copy link

fermuch commented Jul 30, 2018

I found the error. get_url inside iot_data.ex returns an url ending with a slash (/). If you remove the slash, everything works.

Before:

defp get_url(host, url, %{:proto => proto, :port => port}) do
  "#{proto}://#{host}:#{port}#{url}/"
end

After:

defp get_url(host, url, %{:proto => proto, :port => port}) do
  "#{proto}://#{host}:#{port}#{url}"
end

jcomellas added a commit to blockfi/aws-elixir that referenced this issue Oct 23, 2019
@jcomellas
Copy link
Contributor

@ulutomaz @fermuch Please check if the changes in PR #14 fix this issue.

jadeallenx pushed a commit that referenced this issue Jul 16, 2020
* Add type spec to AWS.Client

* Replace calls to deprecated functions

* Change project URLs to those of the aws-beam GitHub org

* Upgrade dependencies

* Generate code based on Go AWS SDK v1.25.14

* Remove modules that are no longer generated

* Regenerate code with fixes to JSON encoding and security token

* Add missing whitespace

* Update repository URLs to point to the aws-beam GitHub organization

* Use List.keyfind/3 instead of Access protocol to retrieve header values

Fixes #5

* Rename url to path when appropriate

* Remove trailing slash from IoT data plane URL path

Fixes #6

* Bump version to 0.6.0
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

3 participants