-
Notifications
You must be signed in to change notification settings - Fork 324
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 console.log(globalThis)
crash #3175
#3267
base: main
Are you sure you want to change the base?
Fix console.log(globalThis)
crash #3175
#3267
Conversation
All contributors have signed the CLA ✍️ ✅ |
console.log(gloabThis)
crash #3175console.log(globalThis)
crash #3175
I have read the CLA Document and I hereby sign the CLA |
Not enabling webGPU in local development would resolve the error message, but just not building a feature is never just a simple bug fix. If we disable webGPU, it would need to be a deliberate decision and communicated properly. |
I think the correct approach is basically not throw an error when webgpu attribute is accessed and just return undefined. |
a658206
to
f8742aa
Compare
My thought process with this approach was that because it's already implicit in the code that you can't run any wgpu code outside of a This felt like a trivial change, so I filled a PR for it per the
Following your suggestion, I changed |
71d0113
to
99487f5
Compare
I think we should not log a warning. Anybody can console.log, in any part of the project (including dependencies). We should treat this case as "webgpu is not implemented". |
99487f5
to
79c839b
Compare
That's a good point, I removed the logs. |
Can you also add a test case where we call console.log? |
cf646f3
to
b88340a
Compare
Yes, of course. I added a test to inspect One thing that I noticed while testing the test function is that the error is being propagated twice (And the second error seems to have a very long stack from the same file). I lack context on the product overall, but I found this weird, so I thought I would mention it just in case it is something.
|
The bug in #3175 is caused by the fact that the function
getGPU
inglobal_scope.c++
is set to only work in aDurableObject
, and that is not the case in local development.The fix is simple: Instead of setting the wgpu flag to be always on, enable it only in CI.
As long as
wgpu
is meant to be only accessible inDureableObjects
, this fix should suffice.I hope I didn't miss anything, and I'm happy to iterate on it otherwise.
Output of the
Bazel run all tests (dbg)
task:Output of
bazel test --config=cli -c dbg --cache_test_results=no //...
: