{"action":"created","issue":{"url":"https://api.github.com/repos/snowflakedb/snowflake-connector-net/issues/99","repository_url":"https://api.github.com/repos/snowflakedb/snowflake-connector-net","labels_url":"https://api.github.com/repos/snowflakedb/snowflake-connector-net/issues/99/labels{/name}","comments_url":"https://api.github.com/repos/snowflakedb/snowflake-connector-net/issues/99/comments","events_url":"https://api.github.com/repos/snowflakedb/snowflake-connector-net/issues/99/events","html_url":"https://github.com/snowflakedb/snowflake-connector-net/issues/99","id":393074556,"node_id":"MDU6SXNzdWUzOTMwNzQ1NTY=","number":99,"title":"403 when fetching chunks from S3","user":{"login":"brendenblack","id":13290283,"node_id":"MDQ6VXNlcjEzMjkwMjgz","avatar_url":"https://avatars0.githubusercontent.com/u/13290283?v=4","gravatar_id":"","url":"https://api.github.com/users/brendenblack","html_url":"https://github.com/brendenblack","followers_url":"https://api.github.com/users/brendenblack/followers","following_url":"https://api.github.com/users/brendenblack/following{/other_user}","gists_url":"https://api.github.com/users/brendenblack/gists{/gist_id}","starred_url":"https://api.github.com/users/brendenblack/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brendenblack/subscriptions","organizations_url":"https://api.github.com/users/brendenblack/orgs","repos_url":"https://api.github.com/users/brendenblack/repos","events_url":"https://api.github.com/users/brendenblack/events{/privacy}","received_events_url":"https://api.github.com/users/brendenblack/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-12-20T14:40:28Z","updated_at":"2018-12-20T16:20:52Z","closed_at":null,"author_association":"NONE","body":"### Issue description\r\nWhen querying Snowflake, I was hitting the timeout period with an error message saying the task was cancelled. \r\n\r\nAfter some investigation, it happens when Snowflake stores the results in S3. The driver was receiving a 403 when trying to fetch the chunks, and using a retry backoff repeatedly until the timeout value was met. \r\n\r\nIt turns out that our Snowflake instance is not returning a \"_qrmk_\" value, and so \r\n[RestRequestImpl](https://github.com/snowflakedb/snowflake-connector-net/blob/v1.0.5/Snowflake.Data/Core/RestRequestImpl.cs#L110) sends the headers:\r\n```\r\n{\r\n  x-amz-server-side-encryption-customer-algorithm: AES256\r\n  x-amz-server-side-encryption-customer-key: \r\n} \r\n```\r\n\r\nThe customer key being blank is causing the 403. When the provided URL is tried using no headers (a get request from incognito mode or Postman) the result is returned. I added a check that avoids setting the headers when _qrmk_ is null and run tests using the driver and had success, e.g.:\r\n```\r\nif (!string.IsNullOrWhiteSpace(getRequest.qrmk)\r\n{\r\n  message.Headers.Add(SSE_C_ALGORITHM, SSE_C_AES);\r\n  message.Headers.Add(SSE_C_KEY, getRequest.qrmk);\r\n}\r\n```\r\n\r\nI am sure that there is a configuration problem somewhere in our instance of Snowflake, but I am not a Snowflake or AWS administrator in our organization, and I can't find the documentation that explains this problem (would love to be shown a link!)\r\n\r\nThat said, I feel that the driver should be able to handle a condition like this (empty _qrmk_ value), either by allowing it to skip adding the headers, or at least a more descriptive error message.\r\n\r\n\r\n### Configuration\r\n*Driver version:* 1.0.5\r\n*Dotnet framework and version:*  .NET standard 2.0\r\n*Server version:* 3.7.4\r\n*Client OS:* Windows 10\r\n"},"comment":{"url":"https://api.github.com/repos/snowflakedb/snowflake-connector-net/issues/comments/449053287","html_url":"https://github.com/snowflakedb/snowflake-connector-net/issues/99#issuecomment-449053287","issue_url":"https://api.github.com/repos/snowflakedb/snowflake-connector-net/issues/99","id":449053287,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0OTA1MzI4Nw==","user":{"login":"howryu","id":6554661,"node_id":"MDQ6VXNlcjY1NTQ2NjE=","avatar_url":"https://avatars2.githubusercontent.com/u/6554661?v=4","gravatar_id":"","url":"https://api.github.com/users/howryu","html_url":"https://github.com/howryu","followers_url":"https://api.github.com/users/howryu/followers","following_url":"https://api.github.com/users/howryu/following{/other_user}","gists_url":"https://api.github.com/users/howryu/gists{/gist_id}","starred_url":"https://api.github.com/users/howryu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/howryu/subscriptions","organizations_url":"https://api.github.com/users/howryu/orgs","repos_url":"https://api.github.com/users/howryu/repos","events_url":"https://api.github.com/users/howryu/events{/privacy}","received_events_url":"https://api.github.com/users/howryu/received_events","type":"User","site_admin":false},"created_at":"2018-12-20T16:20:52Z","updated_at":"2018-12-20T16:20:52Z","author_association":"CONTRIBUTOR","body":"@brendenblack Thanks for your reporting. Can you share which deployment are you running against? Also, can you tell me the query id that is missing qrmk? It would be best if you can enable logging. Our README.md has a section on how to enable logging in .net driver. You don't need to wait till timeout. I just want to see the first query response from server."}}
{"actor":{"display_login":"howryu"}}