[SOLVED] Image Search Abstraction Layer -- Unhandled Promise Rejection?


After Googling this error and having no success in finding a solution, I was curious if any of you campers ran into this same issue. I am using the “google-images” module for this project, and I am getting a “UnhandledPromiseRejectionWarning” whenever I try to run client.search(“Something”, {page: 1});

Exact error I am getting: (node:4396) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): HTTPError: Response code 400 (Bad Request)

Here’s a code snippet of what I am currently testing:

var express = require('express');
var GoogleImages = require('google-images');
var client = new GoogleImages(process.env.KEY, process.env.CX);

var app = express();

app.get('/api/GoogleImages/:query', function(req, res){

    client.search('Steve Angello', {page: 2});



Please help if you ran into something similar and was able to find a fix!

Oops, I goofed. Mixed up the placement for my API key and the CX. :sweat_smile: