Serp Dev not working after update n8n

Serp Dev note working since update to n8n V1.44.1
Serper is not a constructor [line 2]

Error details

Other info

Item Index

0

n8n version

1.44.1 (Self Hosted)

Time

6/15/2024, 5:29:41 PM

Error cause

{ "description": "TypeError", "lineNumber": 2, "message": "Serper is not a constructor [line 2]" }

Serp.Dev

Parameters

Settings


Docs

Code

Supply Data

JavaScript - Supply Data

1

2

const { Serper } = require(‘langchain/tools’);

return new Serper(‘deletedapikey’);

This code will only run and return data if an output got created which is not “Main”.

You can import LangChain and use all available functionality. Debug by using console.log() statements and viewing their output in the browser console.

Inputs

Currently no items exist

Add Input

Outputs

Type

Add Output

I wish this node would…

Error in sub-node ‘Serp.Dev‘

Serper is not a constructor [line 2] Open node

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

Langchain recently move around some code, and we upgraded to a newer minor version. Technically langchain should have not broken the API like this in a minor version, but unfortunately they did.

Can you please try replacing

const { Serper } = require('langchain/tools');

with

const { Serper } = require('@langchain/community/tools/serper');
``` ?
2 Likes

Thank you that worked

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.