You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Be able to deploy to Cloudflare Worker without environment error warning.
Actual Behavior
In deploy to the Cloudflare Worker, as the script initializes and prepares to go live, the Wrangler CLI throws an error:
🌀 Running
✨ Build completed successfully!
🌀 Using namespace for Workers Site "__stage-site-workers_sites_assets"
✨ Success
🌀 Uploading site files
Error: Something went wrong with the request to Cloudflare...
Uncaught Error: Sorry, the Vimeo Player API is not available in this browser.
at line 911
[API code: 10021]
This is likely due to the fact that a Cloudflare Worker is not a node environment. The current detection method for a Node environment fails in this case and incorrectly blocks the deployment. To temporarily deploy I managed to uncomment the following at the bottom of player.js
According to a response on the CF community forum we can identify CFW runtime by checking for: caches.default or WebSocketPair. I could submit a PR to account for this if there's a chance it would be accepted.
I think maybe the way to go here is to replace that check with a check for document? Does the CF environment have that? Happy to review a PR to fix this!
Expected Behavior
Be able to deploy to Cloudflare Worker without environment error warning.
Actual Behavior
In deploy to the Cloudflare Worker, as the script initializes and prepares to go live, the Wrangler CLI throws an error:
This is likely due to the fact that a Cloudflare Worker is not a node environment. The current detection method for a Node environment fails in this case and incorrectly blocks the deployment. To temporarily deploy I managed to uncomment the following at the bottom of player.js
Steps to Reproduce
Import player into an SSR script with
import Player from "@vimeo/player";
then attempt a deployment to a live worker.Possible solutions
I've been looking for a way to detect a CF environment since it's different than Node. I'm thinking that isNode could likely be extended to include this check. I've opened a thread within the CF community asking what an appropriate solution might be: https://community.cloudflare.com/t/how-to-detect-the-cloudflare-worker-runtime/293715
If anyone else has stumbled on this issue or is familiar with CF Workers, please weight in. I'd be happy to make a PR once this is known + tested.
The text was updated successfully, but these errors were encountered: