denoland / denoland/deploy_feedback

help debugging a type error

Open
#242 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
79
Forks
5
PR merge metrics
No merged PRs in 30d

Description

I have a deployment that depends on [kafkasaur](https://deno.land/x/kafkasaur@v0.0.7). It connects and runs correctly on my local machine, but when it runs in deno deploy I get an error message

```
TypeError: Cannot read properties of undefined (reading 'deno')
at https://deno.land/std@0.110.0/node/process.ts:76:108
```

I am sure that there is a dependency issue with kafkasaur somewhere since it hasn't been updated in a while. I'm not expecting deno deploy to support this obscure package, but I don't know how to hunt down the bug for myself since I can't reproduce this error locally.
I managed to remove the above error by replacing each use of `node/process` with the deno equivalent in the kafkasaur library.
However it's replaced with another message that I am stumped by:

```
TypeError: Class extends value undefined is not a constructor or null
at https://deno.land/std@0.62.0/io/readers.ts:7:74
```

I can't find any reference to `https://deno.land/std@0.62.0/io/readers.ts` in my source or kafkasaur.
Do you have any tips for how I can reproduce the environment that deno deploy is using so I can debug this without needing to push to deno deploy each time to check if it works.

## mwe

I have a server running on deno deploy, it crashes when I call `run` in the below module, which is the tutorial example on the kafkasaur homepage. It works if I run locally.

```ts
//producer example
import { Kafka } from "https://deno.land/x/kafkasaur/index.ts"

console.log('imported Kafka')

const kafka = new Kafka({
clientId: 'my_mwe_client',
brokers: [Deno.env.get('BOOTSTRAP_SERVER')!],
ssl: true,
connectionTimeout: 10000,
authenticationTimeout: 10000,
sasl: {
mechanism: 'plain',
username: Deno.env.get('API_KEY')!,
password: Deno.env.get('API_SECRET')!,
}
})

const producer = kafka.producer();

export const run = async () => {
await producer.connect();
await producer.send({
topic: 'test1',
messages: [{
key: 'key',
value: 'hello there',
headers: { 'correlation-id': `${Date.now()}` }
}]
})
console.log('sent message')
}
```

note I don't see a log `imported Kafka` so I think something went wrong in parsing the module

## versions

Local:
```
deno 1.23.3 (release, aarch64-apple-darwin)
v8 10.4.132.8
typescript 4.7.4
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the minimal kafkasaur import in index.ts and compare its behavior locally with Deno Deploy using the shown producer run() example. Inspect the reported std@0.110.0/node/process.ts and std@0.62.0/io/readers.ts stack frames, then isolate the failing dependency; done means a reproducible diagnosis or confirmed compatible dependency path.

Written by the indexing model from the issue text.

Assessment

Tech stack
kafka, node.js, typescript
Domain
backend, cloud
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.