kimbleton
kimbleton•7mo ago

Using bitbucket repositories as dependencies in Deno

I've seen guides about how to use github repositories and use them as dependencies but have not found one about bitbucket repositories. I did some attempts but failed to make the env variable DENO_AUTH_TOKENS work with the bitbucket "raw" url. Anyone with a working setup on this?
5 Replies
Deno AI Helper
Deno AI Helper•7mo ago
To use Bitbucket repositories as dependencies in Deno, you'll need to set up the DENO_AUTH_TOKENS environment variable similarly to how you would for GitHub, but with the appropriate token and hostname for Bitbucket. The documentation provides a general format for the DENO_AUTH_TOKENS environment variable, which supports both bearer tokens and basic auth data. Here's the format it specifies:
DENO_AUTH_TOKENS={token}@{hostname[:port]};{username}:{password}@{hostname[:port]}
DENO_AUTH_TOKENS={token}@{hostname[:port]};{username}:{password}@{hostname[:port]}
For Bitbucket, you would need to obtain an app password or a personal access token, depending on what Bitbucket supports. Once you have your token, you would set the DENO_AUTH_TOKENS environment variable with the token and the Bitbucket hostname that serves raw files. Here's an example of what the DENO_AUTH_TOKENS might look like for Bitbucket:
DENO_AUTH_TOKENS=myBitbucketToken@bitbucket.org
DENO_AUTH_TOKENS=myBitbucketToken@bitbucket.org
Please replace myBitbucketToken with your actual token from Bitbucket. Note that the hostname should match the one that serves the raw content of your Bitbucket repository files. If you're having trouble with the DENO_AUTH_TOKENS environment variable and Bitbucket, make sure that: 1. The token is correct and has the necessary permissions to access the repository. 2. The hostname is correct for Bitbucket's raw content URLs. 3. The format of the DENO_AUTH_TOKENS variable is correct and follows the documentation. If you continue to encounter issues, you can run Deno with the -L debug flag to get more detailed logging, which might help you troubleshoot the problem:
deno run -L debug your_script.ts
deno run -L debug your_script.ts
This will print out a debug message about the number of tokens parsed from the environment variable and will alert you if any of the tokens are malformed. Remember that for
Deno AI Helper
Deno AI Helper•7mo ago
security reasons, it won't print any details about the tokens themselves. If you've followed these steps and are still facing issues, it could be helpful to check Bitbucket's documentation or support resources for any specifics related to accessing raw files from private repositories. 🦕
kimbleton
kimbletonOP•6mo ago
Unfortunately the AI was not helpful. No errors related to the token (in my case bitbucket app password) being malformed. fetch_cached_no_follow is the ones I get before getting Prepared module load. and then comes error "Loading unprepared module: .." In bitbucket it says the key is not accessed. Makes me believe deno is not really using it but if I on purpose make the token bad, it does show that the token is not parsed. It is being parsed when I have it correct. ok after manually clearing the cache I see "redirect policy disallowrf redirection to: '..'" Ah maybe I need to add the allow net cli option nope. was not it Ive now tried variations I could come up with about the env var without any luck. As silly as it may sound, the sad reality is I would have wishes deno to be the next bug thing for my company, but not being able to figure out the issue with bitbucket is total blocker as we have all our repositories there. Even if you cannot help with the matter, I would appreciate if there is someone who can confirm that this indeed works, as I am starting to suspect this is an issue how deno uses the env var with bitbucket i.e bitbucket not being compatible Im tempted to bump this to just get someone using bitbucket to say "yeh works for me" 😄
Thomas
Thomas•6mo ago
Long time ago, I tried the same with gitlab. Someone else already tried it with Azure DevOps. None of that works. I think there is already an issue about it.
kimbleton
kimbletonOP•6mo ago
Thank you so much for this comment! You shown light to this journey.

Did you find this page helpful?