Skip to content

Bug / Usage Issue: Unable to load .whl dependency correctly when using custom --cdn #203

@lifu963

Description

@lifu963

Bug / Usage Issue: Unable to load .whl dependency correctly when using custom --cdn

Describe the problem

I'm using pygbag to build my project and want to host all resource files (including Python wheels) on my own CDN (an object storage service). I specified the CDN with the --cdn flag like this:

pygbag --cdn https://{object_storage_service}/{my_bucket}/archives/0.9/ mygame/

Most assets (e.g. .js, .css, .py, etc.) load correctly. However, the following core dependency fails to load:

https://{object_storage_service}/archives/repo/cp312/pygame_static-1.0-cp312-cp312-wasm32_bi_emscripten.whl

The issue is that this .whl file is not located at that root path. I uploaded it to:

https://{object_storage_service}/{my_bucket}/archives/repo/cp312/pygame_static-1.0-cp312-cp312-wasm32_bi_emscripten.whl

As you can see, the bucket is required in my object storage path, and cannot be omitted.


Expected behavior

All resources, including .whl dependencies, should be loaded relative to the path specified via --cdn.


Actual behavior

While most assets are loaded correctly via the --cdn value, the .whl dependency is requested from a hardcoded root path:

/archives/repo/cp312/...

This causes a 404 error when hosting on custom object storage/CDN setups that require a bucket prefix.


Suggested Solution

  • Allow .whl dependencies to also be loaded relative to the provided --cdn path;

Thank you for creating such an amazing tool! I hope this issue helps others who are deploying pygbag projects to custom object storage/CDNs. 🙏

Metadata

Metadata

Assignees

No one assigned

    Labels

    wontfixThis will not be worked on

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions