PartKeepr
PartKeepr copied to clipboard
Adding part data from OctoPart yields "Uncaught TypeError: this.data.specs[i].metadata is undefined"
Bug description
Part parameters cannot be applied from Octopart results.
Steps to reproduce
- Add or edit a part
- Click on 'Octopart...'
- Select result
- Click 'Add Data'
Expected behavior
I expect the part data to update
Observed behavior
Nothing happens in the UI and the following error is printed to the console:
Uncaught TypeError: this.data.specs[i].metadata is undefined
System Information
- PartKeepr Version: current master (41e1c41)
- Operating System: Linux
- Web Server: apache
- PHP Version: 7.1
- Database and version: MariaDB 10.0
- Reproducible on the demo system: No (because OctoPart API access doesn't work there currently, "No app for token 525ccf58 not found")
JavaScript errors
JavaScript logs
XHR GEThttp://localhost:8080/api/octopart/get/1412597?_dc=1610534645257
[HTTP/1.1 200 OK 346ms]
Uncaught TypeError: this.data.specs[i].metadata is undefined
checkRequirements http://localhost:8080/js/compiled/main2.js:30391
applyData http://localhost:8080/js/compiled/main2.js:30619
onPartDataLoaded http://localhost:8080/js/compiled/main2.js:30360
callback http://localhost:8080/js/compiled/extjs.js:22
onComplete http://localhost:8080/js/compiled/extjs.js:22
onStateChange http://localhost:8080/js/compiled/extjs.js:22
bind http://localhost:8080/js/compiled/extjs.js:22
start http://localhost:8080/js/compiled/extjs.js:22
request http://localhost:8080/js/compiled/extjs.js:22
loadData http://localhost:8080/js/compiled/main2.js:30345
applyData http://localhost:8080/js/compiled/main2.js:30264
onAddClick http://localhost:8080/js/compiled/main2.js:30236
callback http://localhost:8080/js/compiled/extjs.js:22
fireHandler http://localhost:8080/js/compiled/extjs.js:22
onClick http://localhost:8080/js/compiled/extjs.js:22
fire http://localhost:8080/js/compiled/extjs.js:22
fire http://localhost:8080/js/compiled/extjs.js:22
publish http://localhost:8080/js/compiled/extjs.js:22
publishDelegatedDomEvent http://localhost:8080/js/compiled/extjs.js:22
doDelegatedEvent http://localhost:8080/js/compiled/extjs.js:22
onDelegatedEvent http://localhost:8080/js/compiled/extjs.js:22
bind http://localhost:8080/js/compiled/extjs.js:22
I had a similar problem, it was related to the built in tracker/script/cookie blocking in Brave. Switching off Brave's "shields up/down" switch resolved it. Your browser or a plugin may be doing the same.
@sibbi77 you did the latest changes in the Octopart section of the code. As far as I understand it, the requests towards OctoPart are triggered in the PHP server. So the browser's settings should not have any effect in theory. Can you confirm this interpretation?
Do you have a clue what the problem might be?
I'll have a look at the code. If I remember correctly, one user had a different account type at Octopart and had problems with it. The "Pro Free" account has all features and is free. Other account types may deliver fewer data fields or not return data at all (because of a request tailored to the "Pro Free" account. I'm not sure about that.
Hello, i've same problem. Logs: main2.js:30391 Uncaught TypeError: Cannot read property 'unit' of undefined at g.checkRequirements (main2.js:30391) at g.applyData (main2.js:30619) at g.onPartDataLoaded (main2.js:30360) at Object.callback (extjs.js:22) at F.onComplete (extjs.js:22) at F.onStateChange (extjs.js:22) at XMLHttpRequest.t (extjs.js:22)
CAD option is disabled
and account is PRO Free
OctoParts returns data
specs
but response not contain metadata (and unit obviously)
datasheets also isn't working
this.data.datasheets = undefined
this.data.compliance_documents - same imagesets - same this.data.offers (distributors) - same
Only Manufacturer is working fine
@sibbi77 can u help with this issue?
You are not using the latest code; compare to https://github.com/partkeepr/PartKeepr/blob/c6323d57ddc8e7a13d29d2a7a111d7ac2b1dfa40/src/PartKeepr/FrontendBundle/Resources/public/js/Components/OctoPart/DataApplicator.js#L81
You are not using the latest code; compare to
https://github.com/partkeepr/PartKeepr/blob/c6323d57ddc8e7a13d29d2a7a111d7ac2b1dfa40/src/PartKeepr/FrontendBundle/Resources/public/js/Components/OctoPart/DataApplicator.js#L81
Yes, it helped me a lot, thank you!