{"id":47777,"library":"google-batch","title":"google-batch","description":"Sends batch requests to Google REST API by seamlessly integrating with the official googleapis Node.js SDK. Version 0.0.8 is in early development (POC only), with incomplete API support and only JSON request/response types. Not recommended for production. Release cadence is infrequent; last release July 2018. Differentiates by allowing direct use of googleapis methods with batch support, unlike manual batching or alternative libraries like batch-google.","status":"maintenance","version":"0.0.8","language":"javascript","source_language":"en","source_url":"https://github.com/pradeep-mishra/google-batch","tags":["javascript","batch","google","apis","google-batch","batch-google","googleapi","rest","api"],"install":[{"cmd":"npm install google-batch","lang":"bash","label":"npm"},{"cmd":"yarn add google-batch","lang":"bash","label":"yarn"},{"cmd":"pnpm add google-batch","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Required for batch requests; google-batch depends on googleapis' auth and API methods.","package":"googleapis","optional":false}],"imports":[{"note":"CommonJS only; no ESM support. Must use require().","wrong":"import googleBatch from 'google-batch'","symbol":"googleBatch","correct":"const googleBatch = require('google-batch')"},{"note":"Must use googleBatch.require() instead of direct require('googleapis') to enable batch interception.","wrong":"const google = require('googleapis')","symbol":"google","correct":"const google = googleBatch.require('googleapis')"},{"note":"Static method on the imported googleBatch object, not standalone.","wrong":"decodeRawData(rawBody)","symbol":"decodeRawData","correct":"googleBatch.decodeRawData(rawBody)"}],"quickstart":{"code":"const googleBatch = require('google-batch');\nconst batch = new googleBatch();\nconst google = googleBatch.require('googleapis');\n\nbatch.setAuth('YOUR_ACCESS_TOKEN');\n\nconst gmail = google.gmail({ version: 'v1' });\n\nbatch.add(gmail.users.messages.list({ googleBatch: true, userId: 'me', maxResults: 5 }));\nbatch.add(gmail.users.messages.list({ googleBatch: true, userId: 'me', maxResults: 10 }));\n\nbatch.exec((error, responses, errorDetails) => {\n  console.log(responses);\n  batch.clear();\n});","lang":"javascript","description":"Creates a batch of two Gmail list calls and executes them together."},"warnings":[{"fix":"Always load googleapis via googleBatch.require() to ensure batch interception works.","message":"Must use googleBatch.require('googleapis') instead of direct require('googleapis')","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Add googleBatch: true to the parameters of every function call added to the batch.","message":"Each API call object must include googleBatch: true in its parameters to be recognized as a batch call","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Use batch.setAuth() for auth instead of passing to constructor.","message":"Do not pass OAuth2 client in google service constructor; it bypasses batch interception","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Avoid APIs that require non-JSON payloads (e.g., media uploads).","message":"Only application/json request/response types supported. Upload/download not supported.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"For production, use official googleapis batch support or alternative libraries.","message":"Package is in early development (POC) and may not work for many APIs","severity":"deprecated","affected_versions":"0.0.x"}],"env_vars":null,"search_vec":"'0.0.8':21 '2018':48 'allow':51 'altern':64 'api':10,30,73,82 'batch':3,5,58,62,68,71,76,78 'batch-googl':67,77 'cadenc':42 'develop':25 'differenti':49 'direct':52 'earli':24 'googl':2,8,69,72,75,79 'google-batch':1,74 'googleapi':17,55,80 'incomplet':29 'infrequ':44 'integr':13 'javascript':70 'json':34 'juli':47 'last':45 'librari':65 'like':66 'manual':61 'method':56 'node.js':18 'offici':16 'poc':26 'product':40 'recommend':38 'releas':41,46 'request':6 'request/response':35 'rest':9,81 'sdk':19 'seamless':12 'send':4 'support':31,59 'type':36 'unlik':60 'use':53 'version':20","created_at":"2026-06-07T16:53:16.142032+00:00","updated_at":"2026-06-07T16:53:16.142032+00:00","problems":[{"fix":"const google = googleBatch.require('googleapis');","cause":"Directly required googleapis instead of using googleBatch.require()","error":"TypeError: google is not a function"},{"fix":"batch.setAuth('YOUR_ACCESS_TOKEN');","cause":"Missing batch.setAuth() call","error":"Error: No auth provided"},{"fix":"Add googleBatch: true to each API call's parameters object.","cause":"Batch parameters missing googleBatch: true","error":"Error: Bad Request"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/pradeep-mishra/google-batch","github":"https://github.com/pradeep-mishra/google-batch","docs":null,"changelog":null,"pypi":null,"npm":"google-batch","openapi_spec":null,"status_page":null,"smithery":null,"categories":["storage"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}