createApiRequest encodes url, resulting in 404 for pubsub endpoints
See original GitHub issueI’m trying to pull() a subscription using pubsub.projects.subscriptions.pull()
const pubsub = google.pubsub('v1');
const request = {
subscription: 'projects/project-1235/subscriptions/my-subscription',
auth: oAuthClient,
resource: {
maxMessages: 1,
returnImmediately: true,
},
};
pubsub.projects.subscriptions.pull(request, cb);
But it results in a 404.
I looked around and apparently it is because this line here encodes the URI and forward slashes become %2F
and google doesn’t recognise it.
This is probably required for other requests so i’m not quite sure what the fix would be.
Currently I’m creating the request myself and calling it with authClient.request()
. If anyone else is stuck with this, here’s my temporary fix:
const project = 'my-project-12345';
const subscription = 'my-subscription';
const pullReq = {
url: `https://pubsub.googleapis.com/v1/projects/${project}/subscriptions/${subscription}:pull`,
method: 'POST',
paramsSerializer: params =>
qs.stringify(params, { arrayFormat: 'repeat' }), // qs = require('qs')
params: {
maxMessages: 1,
returnImmediately: true,
},
maxContentLength: 2147483648,
validateStatus: status =>
(status >= 200 && status < 300) || status === 304,
};
oAuthClient.request(pullReq).then(response => { ...
Issue Analytics
- State:
- Created 5 years ago
- Reactions:6
- Comments:7 (2 by maintainers)
Top Results From Across the Web
Api is giving 404 when added + as part of URL (%2B)
+ is a special character. It should ideally be should be URL encoded as %2B . Turns out it's not really required though...
Read more >tomnewton - Profile - Bountysource
tomnewton commented on this issueFixing image encoding format conversion. ... this issuecreateApiRequest encodes url, resulting in 404 for pubsub endpoints.
Read more >googleapis documentation
A token which can be passed to a subsequent call to the ListEndpoints method to retrieve the next page of results in ListEndpointsRequest.pageToken....
Read more >Viewing online file analysis results for 'hackfor32bit.exe'
This website uses cookies to enhance your browsing experience. Please note that by continuing to use this site you consent to the terms...
Read more >Google APIs Client Library for Node.js - GitHub Pages
Accelerated Mobile Pages (AMP) URL API * * This API contains a single method, batchGet. ... @example * var google = require('googleapis'); *...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Apologies for the trouble folks “It seemed like a good idea time” (™). Taking a look now.
it is affecting a ton of apis. Looks like a fix is almost there.