-
Notifications
You must be signed in to change notification settings - Fork 925
fix incorrect bindings remote deduplication logic #9854
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
base: main
Are you sure you want to change the base?
fix incorrect bindings remote deduplication logic #9854
Conversation
🦋 Changeset detectedLatest commit: 826b5d2 The changes in this PR will be included in the next version bump. This PR includes changesets to release 5 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
create-cloudflare
@cloudflare/kv-asset-handler
miniflare
@cloudflare/pages-shared
@cloudflare/unenv-preset
@cloudflare/vite-plugin
@cloudflare/vitest-pool-workers
@cloudflare/workers-editor-shared
wrangler
commit: |
66b0754
to
81e81b3
Compare
0f4915b
to
eed0ad6
Compare
eed0ad6
to
826b5d2
Compare
const remoteShortSha = remoteSha.slice(0, 6); | ||
return `remote-${remoteShortSha}`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is 6 characters safe enough to make sure it is unique? What will happen if there are two services end up with the same remoteShortSha
?
What about extracting parts of the remoteProxyConnectionString
instead? Assuming there would be some common bits in all connection strings.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is 6 characters safe enough to make sure it is unique?
I think it's very safe, only a handful of remote proxy connection strings can be present at a time and having collision on such a small amount seems quite impossible to me (I use 6 digit SHAs in git and I virtually never see conflicts even in huge repositories with thousand of commits).
What will happen if there are two services end up with the same remoteShortSha?
The wrong remote resource will be used by one of the two services, but this will only happen if:
- the resources are practically identical (for example an R2 binding with the exact same bucket name)
- the remote resources below to different users, meaning that the remote proxies are started with different auth values (which is unlikely something that we'll provide out of the box anyways)
So based on the above I think that the risk of this being problematic is extremely extremely small, restarting the dev session would fix it, and most likely the impact would also be quite minimal.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about extracting parts of the remoteProxyConnectionString instead? Assuming there would be some common bits in all connection strings.
Yes, I could extract the port from the remoteProxyConnectionString and use that, that would guarantee that we do get different values here
I did consider that but that would require us to basically add coupling/rely on what the remoteProxyConnectionString is (a localhost URL). That's why I preferred going with a SHA approach where we don't care/need to know that the remoteProxyConnectionString contains, all we care about is that it is a string, and as I mentioned above I think that the risk of collisions is so small that it's practically non-existent.
But if you prefer I'm ok using the URL port instead 🙂
Fixes https://jira.cfdata.org/browse/DEVX-2062
Fixes #9842