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

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

#1

Hi,

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});

});

app.listen(process.env.PORT);

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


#2

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