google-maps-services-js icon indicating copy to clipboard operation
google-maps-services-js copied to clipboard

Error: Cannot find module 'combined-stream

Open juztinlazaro opened this issue 1 year ago • 5 comments

Error: Cannot find module 'combined-stream'\nRequire stack:\n- /var/task/node_modules/@googlemaps/google-maps-services-js/node_modules/form-data/lib/form_data.js

image

Please be sure to include as much information as possible:

Environment details

  1. zipcode: 3333
  2. win10
  3. nodejs, serverless

Code example

# example

import GoogleMaps from '@googlemaps/google-maps-services-js';

let googleMapsClient;

function createGoogleMapsClient() {
  if (googleMapsClient) {
    return googleMapsClient;
  }
  googleMapsClient = GoogleMaps.createClient({
    key: process.env.GOOGLE_PLACES_API_KEY,
  });

  return googleMapsClient;
}

export default createGoogleMapsClient;


export function placesAutoComplete(query, options = {}) {
  console.log('placesAutoComplete===');
  const components = {};
  if (options.countryCode)
    components.country =
      options.countryCode; /* can't pass undefined as country */
  return createGoogleMapsClient()
    .places.Autocomplete({
      input: query,
      components,
      types: options.types,
    })
    .then((response) => response.json.predictions);
}

image

seems like form-data trying to find combined-stream

image

Following these steps will guarantee the quickest resolution possible.

Thanks!

juztinlazaro avatar Jun 15 '23 01:06 juztinlazaro

If you would like to upvote the priority of this issue, please comment below or react with :+1: so we can see what is popular when we triage.

@juztinlazaro Thank you for opening this issue. 🙏 Please check out these other resources that might help you get to a resolution in the meantime:

This is an automated message, feel free to ignore.

wangela avatar Jun 15 '23 01:06 wangela

@amuramoto any thoughts?

juztinlazaro avatar Jun 15 '23 04:06 juztinlazaro

When are you seeing this crash? Is it on start up? npm install? Sometime during runtime when the code above is called?

I'm not seeing a similar crash when our test or build steps run. Have you tried wiping node_modules and reinstalling?

amuramoto avatar Jun 15 '23 21:06 amuramoto

@amuramoto yes in startup, FYI im using nodeJS and we deployed it in AWS lambda, already wiping node_modules and reinstalling the packages.

juztinlazaro avatar Jun 15 '23 23:06 juztinlazaro

Is this issue still occuring in the latest version?

The combined-stream package is a transitive dependency of axios (via form-data), and should definitely be installed together with axios. If it's not, there's something bad going on that we can't really help debug.

usefulthink avatar Oct 10 '23 11:10 usefulthink