Skip to content
This repository has been archived by the owner on Apr 20, 2019. It is now read-only.

Batching h2o2 request #84

Closed
palmerjc opened this issue Apr 19, 2018 · 4 comments
Closed

Batching h2o2 request #84

palmerjc opened this issue Apr 19, 2018 · 4 comments
Labels

Comments

@palmerjc
Copy link

I am using the h2o2 module to proxy calls to an external web service and the individual service works just fine. However, when I try to batch several of these calls together I end up getting a 504 error for each request (looking @ line 268 of batch.js). Looking for any guidance as to why this might be.

@palmerjc
Copy link
Author

My batch endpoint looks like the following:

        {
            method: 'GET',
            path: '/license/v3/batch',
            options: {
                auth: 'jwt',
                handler: async function (request, h) {     

                    return (await server.inject({
                        method: 'POST',
                        url: '/batch',
                        headers: request.headers,
                        credentials: {},
                        payload: '{ "requests": [{ "method": "GET", "path": "/license/v3", "query": { "serialNumbers": "398-74797514", "includeRelatedAssets": "true" } }, { "method": "GET", "path": "/license/v3", "query": { "serialNumbers": "561-74369191", "includeRelatedAssets": "true" } }, { "method": "GET", "path": "/license/v3", "query": { "serialNumbers": "398-47374525,398-50132194", "includeRelatedAssets": "true" } }] }'
                    })).result;
                }   
            }                   
        }

It appears that the batch execution is not actually executing the endpoint in the same manner that calling it directly does. For example, in my /license/v3 endpoint I have a mapURI definition that prepares that call for the proxy but that method is never hit by the batch requestor.

@palmerjc
Copy link
Author

I wanted to provide a correction - it does appear that the mapURI is getting called (had my step in the wrong location). However, the call to the endpoint results in Gateway Timeout (504 error) when called via Bassmaster vs working correctly when endpoint is called directly.

@spanditcaa
Copy link

spanditcaa commented Apr 25, 2018

hapijs/h2o2#77 currently debugging.

@spanditcaa spanditcaa self-assigned this Apr 25, 2018
@spanditcaa
Copy link

resolved in h2o2 8.1.1 hapijs/h2o2@1799adb

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants