crewAI icon indicating copy to clipboard operation
crewAI copied to clipboard

Unauthorized Error (403) when Using SERPER_API_KEY for Google Search

Open 0x11c11e opened this issue 1 year ago • 5 comments

Description:

Whenever the software attempts to search in Google using the SERPER_API_KEY, I encounter an unauthorized error despite the API key being set correctly.

Steps to Reproduce:

  1. Run the software with the correctly set SERPER_API_KEY.
  2. Trigger a Google search action, such as
Action: Search the internet
Action Input: {"search_query": "Predictions for used car market in 2024"}

Expected Result:

The software should perform the Google search and return the relevant results.

Actual Result:

The following error message is returned:

{'message': 'Unauthorized.', 'statusCode': 403}

Additional Context:

Log Output:

> Entering new CrewAgentExecutor chain...
To accomplish this task, the first thing I need to do is to gather data about the current trends in the used car market, factors that influence the prices, and any predictions available for 2024. This will allow me to make an educated guess about whether the prices of used cars will go up or down in 2024.

Action: Search the internet
Action Input: {"search_query": "Predictions for used car market in 2024"} 

{'message': 'Unauthorized.', 'statusCode': 403}

Environment:

Software Version:

  • crewai 0.28.8
  • crewai-tools 0.1.6
  • Python 3.12.3
  • pip 24.0

Operating System: Windows Additional Details: Jupyter

0x11c11e avatar May 17 '24 16:05 0x11c11e

Please can you try with the latest version. I just tested it and worked ok

crewai 0.30.11 crewai-tools 0.2.6

gadgethome avatar May 17 '24 16:05 gadgethome

I got the exact same issue with the latest versions.

pip install crewai==0.30.11 crewai_tools==0.2.6 langchain_community

0x11c11e avatar May 17 '24 21:05 0x11c11e

What website is it trying to access

theCyberTech avatar May 18 '24 01:05 theCyberTech

Are you using the local LLMs? I haven't got any success with any of the local LLMs with search tools...

wildcolor avatar May 18 '24 02:05 wildcolor

What website is it trying to access

It is trying to use scaleserp.com to perform a search on google.

Are you using the local LLMs? I haven't got any success with any of the local LLMs with search tools...

No. It is openai api.

I have tested on both windows and Linux, in jupyter and out of it, but the same issue.

0x11c11e avatar May 18 '24 23:05 0x11c11e

Newbie here, but I had a similar issue. It was very, very frustrating... I had gotten an API key from scaleserp.com, but I finally figured out what was actually required was an API key from serper.dev. Now all of those SerperDevTool searches are working for me.

michaelc2005 avatar May 28 '24 00:05 michaelc2005

@michaelc2005 I did exactly the same thing and was driving myself nuts. Thank you!

mintymac avatar Jun 06 '24 21:06 mintymac

Newbie here, but I had a similar issue. It was very, very frustrating... I had gotten an API key from scaleserp.com, but I finally figured out what was actually required was an API key from serper.dev. Now all of those SerperDevTool searches are working for me.

THANK YOU SO MUCH , i was losing my mind over it

Ruffy45 avatar Aug 20 '24 09:08 Ruffy45

what's the final solution for the issue mentioned by @0x11c11e I am facing the same "'message': 'Unauthorized.', 'statusCode': 403}" from serverdev API.

tried many combinations of langchain, langchain-core, crewAI version, not working.

please state your working versions if running

fenil210 avatar Aug 29 '24 14:08 fenil210

what's the final solution for the issue mentioned by @0x11c11e I am facing the same "'message': 'Unauthorized.', 'statusCode': 403}" from serverdev API.

tried many combinations of langchain, langchain-core, crewAI version, not working.

please state your working versions if running

What @michaelc2005 wrote is the final solution.

0x11c11e avatar Aug 29 '24 22:08 0x11c11e

I’ve already taken API from server dev only, it was working till 10 PM, after 10 PM it stopped working even i am left with 2000 credits

On Fri, 30 Aug 2024 at 4:07 AM, Iman Reihanian @.***> wrote:

what's the final solution for the issue mentioned by @0x11c11e https://github.com/0x11c11e I am facing the same "'message': 'Unauthorized.', 'statusCode': 403}" from serverdev API.

tried many combinations of langchain, langchain-core, crewAI version, not working.

please state your working versions if running

What @michaelc2005 https://github.com/michaelc2005 wrote is the final solution.

— Reply to this email directly, view it on GitHub https://github.com/crewAIInc/crewAI/issues/633#issuecomment-2319180836, or unsubscribe https://github.com/notifications/unsubscribe-auth/A43RMY4KHJXXYXJPOSERMJDZT6PCJAVCNFSM6AAAAABH4OTTOKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMJZGE4DAOBTGY . You are receiving this because you commented.Message ID: @.***>

fenil210 avatar Aug 30 '24 04:08 fenil210

serper.dev.

saved me from suicide thanks!

ghost avatar Jan 05 '25 18:01 ghost