Module not found when initializing Chat API
Maintainers usually reply within 2 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 28/100
- Issue type
- Bug
- Clarity
- Needs clarification
- Activity status
- Stale
- Tech stack
- javascript, node.js
Research direction
Start by reproducing the failure with npm run start using @googleapis/chat version ^21.0.0 and inspect the gaxios stack location plus the installed https-proxy-agent package metadata. Compare the dependency state with the reported working googleapis 17.0.1; done means identifying a reproducible resolution and confirming Chat API initialization succeeds.
Written by the indexing model from the issue text.
Description
Environment details
- OS: Windows 11
- Node.js version: 16.0.0
- npm version: 7.4.0
googleapisversion: ^21.0.0
Steps to reproduce
I'm getting the following error when trying to use the chat API. When I run npm run start I get:
Error: Cannot find module 'C:\Users\Martin Carrasco\Desktop\BurnoutZero\boz-google-chat-app\node_modules\https-proxy-agent\dist\index.js'. Please verify that the package.json has a valid "main" entry
at Module._findPath (node:internal/modules/cjs/loader:720:18)
at Module._resolveFilename (node:internal/modules/cjs/loader:1135:27)
at Module._load (node:internal/modules/cjs/loader:990:27)
at Module.require (node:internal/modules/cjs/loader:1237:19)
at require (node:internal/modules/helpers:176:18)
at Object.<anonymous> (C:\Users\Martin Carrasco\Desktop\BurnoutZero\boz-google-chat-app\node_modules\gaxios\build\src\gaxios.js:27:29)
at Module._extensions..js (node:internal/modules/cjs/loader:1437:10)
at Module.load (node:internal/modules/cjs/loader:1212:32) {
code: 'MODULE_NOT_FOUND',
path: 'C:\\Users\\Martin Carrasco\\Desktop\\BurnoutZero\\boz-google-chat-app\\node_modules\\https-proxy-agent\\package.json',
requestPath: 'https-proxy-agent'
}
And here is my code:
const chat = require('@googleapis/chat');
async function createMessage() {
const auth = new chat.auth.GoogleAuth({
// Specify service account details.
keyFilename: 'credentials.json',
// Specify required scopes.
scopes: ['https://www.googleapis.com/auth/chat.bot']
});
const authClient = await auth.getClient();
// Create the Chat API client and authenticate with the service account.
const chatClient = await chat.chat({
version: 'v1',
auth: authClient
});
// Create a Chat message.
const result = await chatClient.spaces.messages.create({
// The space to create the message in.
//
// Replace SPACE_NAME with a space name.
// Obtain the space name from the spaces resource of Chat API,
// or from a space's URL.
parent: 'spaces/AAAAxqmzN8I',
// The message to create.
requestBody: { 'text': 'Hello, world!' }
});
return result;
}
// Execute function then print details about the created message.
(async() => {
const r = await createMessage();
console.log(r);
})()
I tried using all this node versions:
- 21.6.1 (Currently using 64-bit executable)
21.6.0
20.11.0
18.0.0
17.0.0
with no success. The only thing that worked for my was downgrading my googlechat api version to 17.0.1
- Dominant language
- TypeScript
- Stars
- 12.3k
- Forks
- 2k
- Avg merge
- 3d 10h
- Merged PRs (30d)
- 9
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from googleapis/google-api-nodejs-client
-
Difficulty 1/5 Under an hour Newbie friendliness 86/100
googleapis/google-api-nodejs-client#4064 ·
Maintainers usually reply within 2 days
-
Difficulty 4/5 1-2 days Newbie friendliness 5/100
googleapis/google-api-nodejs-client#4067 ·
Maintainers usually reply within 2 days
-
Difficulty 5/5 Over a week Newbie friendliness 1/100
googleapis/google-api-nodejs-client#4063 ·
Maintainers usually reply within 2 days
-
eMudhra/emSign CA compromise (October 2026): what Cloud SDK Node.js Libraries developers need to doOpen
Difficulty 1/5 Under an hour Newbie friendliness 10/100
googleapis/google-api-nodejs-client#4062 ·
Maintainers usually reply within 2 days
-
Difficulty 5/5 Over a week Newbie friendliness 10/100
googleapis/google-api-nodejs-client#4061 ·
Maintainers usually reply within 2 days
All issues in googleapis/google-api-nodejs-client
Similar issues
-
bug UI
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
wardian-app/Wardian#1746 ·
Maintainers usually reply within 1 day
-
area: interop area: sip-core v3
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
fonoster/routr#705 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
clawsweeper:fix-shape-clear clawsweeper:queueable-fix clawsweeper:source-repro impact:ux-friction issue-rating: 🦞 diamond lobster no-stale P2
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
openclaw/openclaw#198551 · 1 comment · 1 reaction ·
Maintainers usually reply within 1 day