Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: support scanoss bundling #14650

Merged
merged 1 commit into from
Dec 19, 2024

Conversation

sdirix
Copy link
Member

@sdirix sdirix commented Dec 18, 2024

What it does

scanoss depends on node-fetch <3. node-fetch in that version fails their instance checks, as it relies on constructor/class names which are removed by the backend bundling.

Adjusts the generated webpack configuration to keep the class name for AbortSignal as this is the name checked in node-fetch.

fixes #14648

How to test

yarn && yarn browser build:production

image

Without the adjusted webpack generation, scanoss will fail

Follow-ups

As an alternative we could set a resolution to node-fetch >3, however

So to get rid of this workaround we need to either

  • encourage / support scanoss to migrate to node-fetch v3 and replace form-data usage, AND/OR
  • encourage / support node-fetch to backport their improved checks to version v2

Note that the ai-openai and ai-anthropic also have a dependency to node-fetch v2, however during regular use we don't seem to hit the problematic code paths in there, at least I was not able to trigger them.

Breaking changes

  • This PR introduces breaking changes and requires careful review. If yes, the breaking changes section in the changelog has been updated.

Review checklist

Reminder for reviewers

@sdirix sdirix requested a review from JonasHelming December 18, 2024 21:28
@sdirix sdirix force-pushed the fix-scanoss-production branch from 7e4cf5e to 4f11c6b Compare December 18, 2024 21:44
scanoss depends on node-fetch <3. node-fetch in that version fails their
instance checks, as it relies on constructor/class names which are
removed by the backend bundling.

Adjusts the generated webpack configuration to keep the class name for
AbortSignal as this is the name checked in node-fetch.

fixes eclipse-theia#14648
@tsmaeder
Copy link
Contributor

@sdirix when I press the "scanoss" button in the chat view on a production build of the electron version, nothing happens and I get the following exception:

rpc-message-encoder.ts:184 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading '0')
    at s.doScanContent (/C:/Users/thomas/cod…nd\main.js:1:435940)
    at async h.onRequest (/C:/Users/thomas/cod…kend\306.js:1:52201)
    at async c.handleRequest (/C:/Users/thomas/cod…kend\306.js:1:47057)
deserialize	@	rpc-message-encoder.ts:184
D	@	unpack.js:424
i	@	unpack.js:522
X	@	unpack.js:994
D	@	unpack.js:418
x	@	unpack.js:197
unpack	@	unpack.js:104
decode	@	unpack.js:176
decode	@	rpc-message-encoder.ts:163
parse	@	rpc-message-encoder.ts:167
(anonymous)	@	rpc-protocol.ts:88
(anonymous)	@	event.ts:176
invoke	@	event.ts:184
fire	@	event.ts:327
handleData	@	channel.ts:255
handleMessage	@	channel.ts:209
(anonymous)	@	channel.ts:167
(anonymous)	@	event.ts:176
invoke	@	event.ts:184
fire	@	event.ts:327
t	@	ws-connection-source.ts:156
n.emit	@	index.js:136
emitEvent	@	socket.js:559
onevent	@	socket.js:546
onpacket	@	socket.js:514
n.emit	@	index.js:136
(anonymous)	@	manager.js:237
await in (anonymous) (async)		
Be	@	react-dom.production.min.js:54
ze	@	react-dom.production.min.js:54
(anonymous)	@	react-dom.production.min.js:55
Nn	@	react-dom.production.min.js:105
Fn	@	react-dom.production.min.js:106
(anonymous)	@	react-dom.production.min.js:117
cc	@	react-dom.production.min.js:273
Oe	@	react-dom.production.min.js:52
Hn	@	react-dom.production.min.js:109
qt	@	react-dom.production.min.js:74
Gt	@	react-dom.production.min.js:73

Copy link
Contributor

@tsmaeder tsmaeder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to have no untoward effects on Theia in the production build. Can't test it fixes the ScanOSS problem until we have the other Windows fix merged, but at least it's no worse (the feature does not work anyway)

@sdirix sdirix merged commit ffcea18 into eclipse-theia:master Dec 19, 2024
11 checks passed
@sdirix sdirix deleted the fix-scanoss-production branch December 19, 2024 09:17
@github-actions github-actions bot added this to the 1.58.0 milestone Dec 19, 2024
jfaltermeier pushed a commit that referenced this pull request Dec 19, 2024
scanoss depends on node-fetch <3. node-fetch in that version fails their
instance checks, as it relies on constructor/class names which are
removed by the backend bundling.

Adjusts the generated webpack configuration to keep the class name for
AbortSignal as this is the name checked in node-fetch.

fixes #14648
@sdirix
Copy link
Member Author

sdirix commented Dec 19, 2024

The error mentioned was an issue only appearing on Windows. It was fixed here: #14653

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

SCANOSS does not work in built Theia IDE
2 participants