dylang / shortid

Short id generator. Url-friendly. Non-predictable. Cluster-compatible.

Home Page:https://www.npmjs.org/package/shortid

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

shortid.generate(), broken!

latifs opened this issue · comments

Hi guys,

I'm using shortid in my react app, specifically in a component that deals with generating "quotes" (as in prices).

I'm using shortid.generate() to create a unique id for the items in the quote.
import shortid from 'shortid'; const item = { id: shortid.generate(), ...

Ever since the recent update though , this breaks the app and I get a:
Uncaught TypeError: Cannot read property 'id' of undefined

Any Idea why?
Thanks

Hi. Can you show stack trace? The full error text?

Also I need your browser.

Hi @ai,
I use Chrome Version 67.0.3396.99 (Official Build) (64-bit).
but the same thing happen in Safari too.

And here is the message I get from chrome that prevents the page to load fully:

2cb37cf63063697274b0d94ad88c72992efe856b.js:27 Uncaught TypeError: Cannot read property 'id' of undefined at cluster-worker-id.js (2cb37cf63063697274b0d94ad88c72992efe856b.js:27) at fileEvaluate (2cb37cf63063697274b0d94ad88c72992efe856b.js:1) at require (2cb37cf63063697274b0d94ad88c72992efe856b.js:1) at index.js (2cb37cf63063697274b0d94ad88c72992efe856b.js:27) at fileEvaluate (2cb37cf63063697274b0d94ad88c72992efe856b.js:1) at require (2cb37cf63063697274b0d94ad88c72992efe856b.js:1) at index.js (2cb37cf63063697274b0d94ad88c72992efe856b.js:27) at fileEvaluate (2cb37cf63063697274b0d94ad88c72992efe856b.js:1) at require (2cb37cf63063697274b0d94ad88c72992efe856b.js:1) at AddToQuote.js (2cb37cf63063697274b0d94ad88c72992efe856b.js:77) at fileEvaluate (2cb37cf63063697274b0d94ad88c72992efe856b.js:1) at require (2cb37cf63063697274b0d94ad88c72992efe856b.js:1) at ProductDetail.js (2cb37cf63063697274b0d94ad88c72992efe856b.js:73) at fileEvaluate (2cb37cf63063697274b0d94ad88c72992efe856b.js:1) at require (2cb37cf63063697274b0d94ad88c72992efe856b.js:1) at index.js (2cb37cf63063697274b0d94ad88c72992efe856b.js:73) at fileEvaluate (2cb37cf63063697274b0d94ad88c72992efe856b.js:1) at require (2cb37cf63063697274b0d94ad88c72992efe856b.js:1) at routes.js (2cb37cf63063697274b0d94ad88c72992efe856b.js:82) at fileEvaluate (2cb37cf63063697274b0d94ad88c72992efe856b.js:1) at require (2cb37cf63063697274b0d94ad88c72992efe856b.js:1) at MainApp.js (2cb37cf63063697274b0d94ad88c72992efe856b.js:82) at fileEvaluate (2cb37cf63063697274b0d94ad88c72992efe856b.js:1) at require (2cb37cf63063697274b0d94ad88c72992efe856b.js:1) at main.js (2cb37cf63063697274b0d94ad88c72992efe856b.js:82) at fileEvaluate (2cb37cf63063697274b0d94ad88c72992efe856b.js:1) at require (2cb37cf63063697274b0d94ad88c72992efe856b.js:1) at 2cb37cf63063697274b0d94ad88c72992efe856b.js:82

Thanks for your help.

@ai,
I tried right now in package.json to replace:
"shortid": "^2.2.8"
with
"shortid": "2.2.8"

now the page loads and the error is gone,
so probably something with shortid 2.2.11

I will fix it after few hours.

@ai Thanks!

Should be fixed in 2.2.12

(BTW, you have something bad without your JS bundle, you shouldn’t see this file)