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

Node API requests ignore the endpoint.path property #268

Closed
yonatang opened this issue Apr 30, 2014 · 4 comments
Closed

Node API requests ignore the endpoint.path property #268

yonatang opened this issue Apr 30, 2014 · 4 comments

Comments

@yonatang
Copy link

In lib/http/node.js, during the generation of AWS.NodeHttpClient, the path prefix is set only if httpOptions is set. In case a custom Endpoint is used with path defined, the request will be sent without it.
For example, after using the following AWS.S3() configuration:

 var ep=new AWS.Endpoint("http://localhost:9444/s3");
 var s3=new AWS.S3({"accessKeyId": "EXAMPLE", "secretAccessKey":"EXAMPLEKEY", 
     endpoint:ep});

Executing an s3.putObject({Bucket:'bucket', Key:'file.txt'}) command will issue a PUT request to http://localhost:9444/bucket/file.txt instead of http://localhost:9444/s3/bucket/file.txt.

It looks like the following patch resolves it:

Index: lib/http/node.js
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- lib/http/node.js    (revision )
+++ lib/http/node.js    (revision )
@@ -18,6 +18,8 @@
         pathPrefix += ':' + endpoint.port;
       }
       endpoint = new AWS.Endpoint(httpOptions.proxy);
+    } else {
+      pathPrefix = endpoint.path;  
     }

     var useSSL = endpoint.protocol === 'https:';
@lsegal
Copy link
Contributor

lsegal commented Apr 30, 2014

What version of the SDK are you using? This was previously reported and fixed in #202. The latest version (2.0.0-rc.14) contains logic to handle adding the path portion of the endpoint to the URI.

@yonatang
Copy link
Author

yonatang commented May 1, 2014

Sorry, I had the ~ operator on the dependency version, causing my to check
it on an old (rc9) version of the sdk. Using rc14 does resolve the issue.
Thanks.

On Wed, Apr 30, 2014 at 11:46 PM, Loren Segal notifications@github.comwrote:

What version of the SDK are you using? This was previously reported and
fixed in #202 #202. The latest
version (2.0.0-rc.14) contains logic to handle adding the path portion of
the endpoint to the URI.


Reply to this email directly or view it on GitHubhttps://github.com//issues/268#issuecomment-41848153
.

@lsegal
Copy link
Contributor

lsegal commented May 5, 2014

Closing since this is resolved.

@lsegal lsegal closed this as completed May 5, 2014
@lock
Copy link

lock bot commented Sep 30, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.

@lock lock bot locked as resolved and limited conversation to collaborators Sep 30, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants