[GH-ISSUE #1509] Documentation of Langchain with Javascript is not good at all #7

Closed
opened 2026-02-17 17:18:58 -05:00 by yindo · 4 comments
Owner

Originally created by @yours7himanshu on GitHub (Dec 3, 2024).
Original GitHub issue: https://github.com/langchain-ai/docs/issues/1509

@akira @nfcampos
Facing issue on passing the Grok api key and langchain api key here is the code i had wrote but its showing invalid api key eventhough i passed it correctly...check the code attached with the screenshot-
image

Originally created by @yours7himanshu on GitHub (Dec 3, 2024). Original GitHub issue: https://github.com/langchain-ai/docs/issues/1509 @akira @nfcampos Facing issue on passing the Grok api key and langchain api key here is the code i had wrote but its showing invalid api key eventhough i passed it correctly...check the code attached with the screenshot- ![image](https://github.com/user-attachments/assets/c569c1ac-c016-4cec-8356-9bfe17ff5e68)
yindo added the external label 2026-02-17 17:18:58 -05:00
yindo closed this issue 2026-02-17 17:18:58 -05:00
Author
Owner

@hinthornw commented on GitHub (Dec 3, 2024):

Hi @yours7himanshu , what are you looking to accomplish?

The langchain api key isn't somethign ChatGroq expects.

To activate tracing you'd set both LANGCHAIN_API_KEY (or LANGSMITH_API_KEY) and LANGSMITH_TRACING=true in your environment, but your code doesn't have to be aware of that

@hinthornw commented on GitHub (Dec 3, 2024): Hi @yours7himanshu , what are you looking to accomplish? The langchain api key isn't somethign ChatGroq expects. To activate tracing you'd set both LANGCHAIN_API_KEY (or LANGSMITH_API_KEY) and LANGSMITH_TRACING=true in your environment, but your code doesn't have to be aware of that
Author
Owner

@yours7himanshu commented on GitHub (Dec 4, 2024):

@hinthornw i had removed that too but still don't know i am getting this warning and and error with invalid api key don't know why even though in my opinion i am doing correctly i had used .env file to store api keys and using it.
Error i am getting-
[DEP0040] DeprecationWarning: The punycode module is deprecated. Please use a userland alternative instead.
(Use node --trace-deprecation ... to show where the warning was created)
file:///C:/Users/dinka/Documents/LangChain/node_modules/groq-sdk/error.mjs:39
return new AuthenticationError(status, error, message, headers);
^

AuthenticationError: 401 {"error":{"message":"Invalid API Key","type":"invalid_request_error","code":"invalid_api_key"}}
at APIError.generate (file:///C:/Users/dinka/Documents/LangChain/node_modules/groq-sdk/error.mjs:39:20)
at Groq.makeStatusError (file:///C:/Users/dinka/Documents/LangChain/node_modules/groq-sdk/core.mjs:268:25)
at Groq.makeRequest (file:///C:/Users/dinka/Documents/LangChain/node_modules/groq-sdk/core.mjs:311:30)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async RetryOperation._fn (C:\Users\dinka\Documents\LangChain\node_modules\p-retry\index.js:50:12) {
status: 401,
headers: {
'alt-svc': 'h3=":443"; ma=86400',
'cache-control': 'private, max-age=0, no-store, no-cache, must-revalidate',
'cf-cache-status': 'DYNAMIC',
'cf-ray': '8ec99310bdd97fe9-MAA',
connection: 'keep-alive',
'content-length': '96',
'content-type': 'application/json',
date: 'Wed, 04 Dec 2024 06:00:09 GMT',
server: 'cloudflare',
'set-cookie': '__cf_bm=HLiCJzsEGAJ.Ek3hUyHMz39rCRkb3LCS2PmtRukXXuI-1733292009-1.0.1.1-v1ri.qFuAqahDYRj6DHyFr89pUgZxM5tm8rCY6Cytmg7VElplbnGlMIzObRd7UN1V7Lx8uUv82ooNw1FTsFIZg; path=/; expires=Wed, 04-Dec-24 06:30:09 GMT; domain=.groq.com; HttpOnly; Secure; SameSite=None',
vary: 'Origin',
via: '1.1 google',
'x-request-id': 'req_01je8429rcfqa87khvkd6vqbqb'
},
error: {
error: {
message: 'Invalid API Key',
type: 'invalid_request_error',
code: 'invalid_api_key'
}
},
attemptNumber: 1,
retriesLeft: 6
}

Attached sreenshot-
image

@yours7himanshu commented on GitHub (Dec 4, 2024): @hinthornw i had removed that too but still don't know i am getting this warning and and error with invalid api key don't know why even though in my opinion i am doing correctly i had used .env file to store api keys and using it. Error i am getting- [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead. (Use `node --trace-deprecation ...` to show where the warning was created) file:///C:/Users/dinka/Documents/LangChain/node_modules/groq-sdk/error.mjs:39 return new AuthenticationError(status, error, message, headers); ^ AuthenticationError: 401 {"error":{"message":"Invalid API Key","type":"invalid_request_error","code":"invalid_api_key"}} at APIError.generate (file:///C:/Users/dinka/Documents/LangChain/node_modules/groq-sdk/error.mjs:39:20) at Groq.makeStatusError (file:///C:/Users/dinka/Documents/LangChain/node_modules/groq-sdk/core.mjs:268:25) at Groq.makeRequest (file:///C:/Users/dinka/Documents/LangChain/node_modules/groq-sdk/core.mjs:311:30) at process.processTicksAndRejections (node:internal/process/task_queues:105:5) at async RetryOperation._fn (C:\Users\dinka\Documents\LangChain\node_modules\p-retry\index.js:50:12) { status: 401, headers: { 'alt-svc': 'h3=":443"; ma=86400', 'cache-control': 'private, max-age=0, no-store, no-cache, must-revalidate', 'cf-cache-status': 'DYNAMIC', 'cf-ray': '8ec99310bdd97fe9-MAA', connection: 'keep-alive', 'content-length': '96', 'content-type': 'application/json', date: 'Wed, 04 Dec 2024 06:00:09 GMT', server: 'cloudflare', 'set-cookie': '__cf_bm=HLiCJzsEGAJ.Ek3hUyHMz39rCRkb3LCS2PmtRukXXuI-1733292009-1.0.1.1-v1ri.qFuAqahDYRj6DHyFr89pUgZxM5tm8rCY6Cytmg7VElplbnGlMIzObRd7UN1V7Lx8uUv82ooNw1FTsFIZg; path=/; expires=Wed, 04-Dec-24 06:30:09 GMT; domain=.groq.com; HttpOnly; Secure; SameSite=None', vary: 'Origin', via: '1.1 google', 'x-request-id': 'req_01je8429rcfqa87khvkd6vqbqb' }, error: { error: { message: 'Invalid API Key', type: 'invalid_request_error', code: 'invalid_api_key' } }, attemptNumber: 1, retriesLeft: 6 } Attached sreenshot- ![image](https://github.com/user-attachments/assets/55db881c-61db-450d-be7f-7a0a744d4619)
Author
Owner

@hinthornw commented on GitHub (Dec 5, 2024):

And is the API key correct?

@hinthornw commented on GitHub (Dec 5, 2024): And is the API key correct?
Author
Owner

@yours7himanshu commented on GitHub (Dec 5, 2024):

Yes it's 100% correct

On Fri, Dec 6, 2024, 5:36 AM William FH @.***> wrote:

And is the API key correct?


Reply to this email directly, view it on GitHub
https://github.com/langchain-ai/docs/issues/1509#issuecomment-3548402999,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/A2TEW6GXE5Z2MCDSSMAIPKD2EDS7BAVCNFSM6AAAAABS6UQXYWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKMRRG43DMMRUHA
.
You are receiving this because you were mentioned.Message ID:
@.***>

@yours7himanshu commented on GitHub (Dec 5, 2024): Yes it's 100% correct On Fri, Dec 6, 2024, 5:36 AM William FH ***@***.***> wrote: > And is the API key correct? > > — > Reply to this email directly, view it on GitHub > <https://github.com/langchain-ai/docs/issues/1509#issuecomment-3548402999>, > or unsubscribe > <https://github.com/notifications/unsubscribe-auth/A2TEW6GXE5Z2MCDSSMAIPKD2EDS7BAVCNFSM6AAAAABS6UQXYWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKMRRG43DMMRUHA> > . > You are receiving this because you were mentioned.Message ID: > ***@***.***> >
yindo changed title from Documentation of Langchain with Javascript is not good at all to [GH-ISSUE #1509] Documentation of Langchain with Javascript is not good at all 2026-06-05 17:24:32 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/docs#7