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

Use flutter.js bootstrapping #2960

Merged
merged 2 commits into from
May 9, 2024
Merged

Conversation

johnpryan
Copy link
Contributor

@johnpryan johnpryan commented May 9, 2024

Attempt 2 at landing #2792

This loosens the CORS header for canvaskit.wasm since we were seeing this error:

Access to fetch at 'https://dartpad.dev/canvaskit/chromium/canvaskit.wasm' from origin 'null' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

@johnpryan johnpryan marked this pull request as ready for review May 9, 2024 18:34
@johnpryan johnpryan requested a review from devoncarew May 9, 2024 18:34
@@ -83,6 +83,15 @@
}
]
},
{
"source": "/canvaskit/chromium/canvaskit.wasm",
Copy link
Member

Choose a reason for hiding this comment

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

This firebase CORS config looks reasonable to me. I wonder - do we expect to need to allowlist additional resources in the future? For this filename to change?

I also don't know if we're holding flutter web uniquely, or if this resource + CORS pattern should be part of general 'hosting a flutter web app' guidance.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think we will need to keep evaluating how we're configuring CORS and reevaluate how to simplify our configuration once we loosen things up enough to get them working.

We don't have good docs on how to configure CORS for Flutter web + Wasm, but I'm still not sure if this is a Flutter web specific configuration or if this is due to how we're sandboxing the iframe element.

cc @eyebrowsoffire @ditman @kevmoo

Copy link
Member

@ditman ditman May 9, 2024

Choose a reason for hiding this comment

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

With the incoming --wasm mode, there's a whole host of "CORS cousins" that will need similar configuration + documentation, like COEP or CORP. This file is cool (but of course it depends on the hosting/CDN that the developer picks)!

@johnpryan johnpryan merged commit 578bd4e into main May 9, 2024
7 checks passed
@johnpryan johnpryan deleted the revert-2959-revert-2792-flutter-js branch May 9, 2024 19:41
@johnpryan
Copy link
Contributor Author

Just to close the loop, this fixed the CORS error.

There's still some optimization we could do here, we are still throwing away a lot of the assets that we could be sharing between compilations, but this gets us migrated to the new bootstrapping system.

Thanks @ditman for the help!

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

Successfully merging this pull request may close these issues.

None yet

3 participants