kriasoft / kriasoft/cloudflare-ips

ips is undefined

Open
#1 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
8
Forks
3
PR merge metrics
No merged PRs in 30d

Description

Using the second example from the docs throws the error
**TypeError: Cannot read property 'Symbol(Symbol.iterator)' of undefined`**
```javascript
cloudflareIPs((err, ips) => {
app.set('trust proxy', ['loopback', ...ips]);
});
```

The callback with 2 params doesn't work as there is no `err` passed. I think easiest solution is to just remove this callback style from the docs.

Fix: remove `err` from the callback.
```javascript
cloudflareIPs((ips) => {
app.set('trust proxy', ['loopback', ...ips]);
});
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the second callback example in the documentation, which currently declares err and leaves ips undefined. Update the example to use the single callback parameter shown in the issue, then verify that the documented spread expression no longer throws the reported TypeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
express, javascript, node.js
Domain
documentation
Issue type
Documentation
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.