Giter Club home page Giter Club logo

Comments (11)

howryu avatar howryu commented on August 29, 2024

Can you try to enable the logs? Last section in README.md has a sample file on how to enable logging.

However, I did not expect much from logging since we mask the password value in logging due to security reasons, but it worth trying. I can try asp.net app from my side as well since I never tested asp.net app before.

from snowflake-connector-net.

gogowater avatar gogowater commented on August 29, 2024

I can tell you there is no special characters in the password that would conflict with json encoding or uri encoding. Perhaps I would need to run debug mode on the source code.

UPDATES: I step into the source code, and I can very the SFSSession has the correct password. Even though I compare json data with working version and non-working version, virtually there isn't much different.

Here is the log:
[2018-05-30 16:38:09,900] [140] [INFO ] [Snowflake.Data.Core.SFSessionProperties] Start parsing connection string.
[2018-05-30 16:38:09,904] [140] [INFO ] [Snowflake.Data.Core.SFSessionProperties] Connection property: SCHEME, value: https
[2018-05-30 16:38:09,905] [140] [INFO ] [Snowflake.Data.Core.SFSessionProperties] Connection property: HOST, value: dz16756.snowflakecomputing.com
[2018-05-30 16:38:09,905] [140] [INFO ] [Snowflake.Data.Core.SFSessionProperties] Connection property: PORT, value: 443
[2018-05-30 16:38:09,905] [140] [INFO ] [Snowflake.Data.Core.SFSessionProperties] Connection property: USER, value: readonly
[2018-05-30 16:38:09,905] [140] [INFO ] [Snowflake.Data.Core.SFSessionProperties] Connection property: PASSWORD, value: XXXXXXXX
[2018-05-30 16:38:09,905] [140] [INFO ] [Snowflake.Data.Core.SFSessionProperties] Connection property: ACCOUNT, value: dz16756
[2018-05-30 16:38:09,906] [140] [INFO ] [Snowflake.Data.Core.SFSessionProperties] Connection property: DB, value: analytics
[2018-05-30 16:38:09,906] [140] [INFO ] [Snowflake.Data.Core.SFSessionProperties] Connection property: WAREHOUSE, value: analytics
[2018-05-30 16:38:09,909] [140] [DEBUG] [Snowflake.Data.Core.SFSessionProperties] Sesssion property CONNECTION_TIMEOUT set to default value: 0
[2018-05-30 16:38:09,910] [140] [DEBUG] [Snowflake.Data.Core.SFSession] Open Session
[2018-05-30 16:38:09,913] [140] [DEBUG] [Snowflake.Data.Core.SFSession] Login Request Data: SFRestRequest {url: https://dz16756.snowflakecomputing.com/session/v1/login-request?warehouse=analytics&databaseName=analytics&schemaName=&requestId=05c66a9d-84b8-46ac-80a8-c275ecc42bb4, request body: AuthRequest {data: AuthRequestData {ClientAppVersion: 0.3.0.0 , AccountName: dz16756, loginName: readonly } } }
[2018-05-30 16:38:10,814] [132] [DEBUG] [Snowflake.Data.Core.HttpUtil+RetryHandler] Success Response: StatusCode: 200, ReasonPhrase: 'OK', Version: 1.1, Content: System.Net.Http.StreamContent, Headers:
{
Strict-Transport-Security: max-age=31536000
X-Frame-Options: deny
Connection: keep-alive
Date: Wed, 30 May 2018 23:38:08 GMT
Server: nginx
Content-Length: 364
Content-Type: application/json
}
[2018-05-30 16:38:10,840] [140] [ERROR] [Snowflake.Data.Core.SFSession] Authentication failed
Error: Incorrect username or password was specified. SqlState: , VendorCode: 390100, QueryId:
[2018-05-30 16:38:10,945] [106] [DEBUG] [Snowflake.Data.Core.HttpUtil+RetryHandler] Failed Response: StatusCode: 401, ReasonPhrase: 'Unauthorized', Version: 1.1, Content: System.Net.Http.StreamContent, Headers:
{
Connection: keep-alive
Date: Wed, 30 May 2018 23:38:08 GMT
Server: nginx
Content-Length: 123
Content-Type: application/json
}
[2018-05-30 16:38:10,945] [106] [DEBUG] [Snowflake.Data.Core.HttpUtil+RetryHandler] Sleep 1 seconds and then retry the request
[2018-05-30 16:38:12,266] [132] [DEBUG] [Snowflake.Data.Core.HttpUtil+RetryHandler] Failed Response: StatusCode: 401, ReasonPhrase: 'Unauthorized', Version: 1.1, Content: System.Net.Http.StreamContent, Headers:
{
Connection: keep-alive
Date: Wed, 30 May 2018 23:38:09 GMT
Server: nginx
Content-Length: 123
Content-Type: application/json
}
[2018-05-30 16:38:12,266] [132] [DEBUG] [Snowflake.Data.Core.HttpUtil+RetryHandler] Sleep 2 seconds and then retry the request

from snowflake-connector-net.

howryu avatar howryu commented on August 29, 2024

Seems that username is not correct.

[2018-05-30 16:38:09,905] [140] [INFO ] [Snowflake.Data.Core.SFSessionProperties] Connection property: USER, value: readonly
[2018-05-30 16:38:09,905] [140] [INFO ] [Snowflake.Data.Core.SFSessionProperties] Connection property: PASSWORD, value: XXXXXXXX

Are you passing in readonly as username? Or there is a bug in our code that parse the string wrongly?

from snowflake-connector-net.

gogowater avatar gogowater commented on August 29, 2024

that is correct username "readonly".

from snowflake-connector-net.

gogowater avatar gogowater commented on August 29, 2024

So I manually copy and paste a code snippet that works and try on different projects. Somehow it works in a sample mvc project, it works in our main web app, but it doesn't work in the "integration" web app where I needed. I commented out quite a bit of settings in the web.config and try to narrow down the cause of the problem.

            var connection = new SnowflakeDbConnection();
            try
            {
                connection.ConnectionString = "scheme=https;host=dz16756.snowflakecomputing.com;port=443;user=readonly;password=blah;account=dz16756;db=analytics;warehouse=analytics";
                connection.Open();
                var cmd = connection.CreateCommand();
                cmd.CommandText = "select 1";
                cmd.CommandType = System.Data.CommandType.Text;

                var reader = cmd.ExecuteReader();
                var result = reader.HasRows;
            }
            finally
            {
                connection.Close();
            }

from snowflake-connector-net.

howryu avatar howryu commented on August 29, 2024

Ok I will try as well.

from snowflake-connector-net.

gogowater avatar gogowater commented on August 29, 2024

Issue found.

Someone overrides the default Json Serializer Settings globally which corrupted the httprequest body. :(

from snowflake-connector-net.

contact2rahulpathak avatar contact2rahulpathak commented on August 29, 2024

Someone overrides the default Json Serializer Settings globally which corrupted the httprequest body. :(
can you help were and what need to done
if i am not wrong are u talking about this as i cant see global.ascx file

from snowflake-connector-net.

arunbalaa avatar arunbalaa commented on August 29, 2024

@gogowater Can you provide more insights of what fix you did to make this work ? I am facing exactly the same problem, the connection works on a console application but not with the ASP.NET application.

from snowflake-connector-net.

contact2rahulpathak avatar contact2rahulpathak commented on August 29, 2024

from snowflake-connector-net.

gogowater avatar gogowater commented on August 29, 2024

@arunbalaa
In my case, someone was modifiying the serialization formatter in the Json.NET, so the password was in wrong cases. Best way to verify this is to download the source codes and reference the project to the source. Then you can step into the source and verify the http payload that sends to the snowflake. Then, you can test the exact payload with postman. Hope this helps.

from snowflake-connector-net.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.