I am trying to install a private Github package to a Gatsby project I'm working on that will get deployed to Netlify, but I am continuing to get a 401 Unauthorized...
When I add my token inline, or use my ~/.npmrc file it works and installs fine but doesn't work when I am using a local environment variable.
Here is my .npmrc file...
//npm.pkg.github.com/:_authToken=$NPM_TOKEN
#OWNER:registry=https://npm.pkg.github.com/OWNER
NOTE
I have also tried this with no luck -
//npm.pkg.github.com/:_authToken=${NPM_TOKEN}
#OWNER:registry=https://npm.pkg.github.com/OWNER
How do I get my environment variable to work inside my local project .npmrc file?
UPDATE
I managed to get it working locally by removing the extra the last / from github.com (shown below), but this still doesn't fix the error on the Netlify side.
- //npm.pkg.github.com/:_authToken=$NPM_TOKEN
+ //npm.pkg.github.com:_authToken=$NPM_TOKEN
Any help would be appreciated, thanks.
I got it working but I'm sure there's a better way...
The .npmrc has to be
To get it working locally -
//npm.pkg.github.com:_authToken=$READ_TOKEN
#OWNER:registry=https://npm.pkg.github.com/OWNER
However this returns a 401 unauthorised error on Netlify...
To Get it to work on Netlify -
//npm.pkg.github.com/:_authToken=${READ_TOKEN}
registry=https://npm.pkg.github.com/OWNER
However like-wise this doesn't work locally...
At the moment I'm having to switch them out manually depending on whether I'm working locally or using it in production but as I say I think there must be a better way to do that.
Related
I am trying to setup a Github Codespace env with PHP and MySQL to run CraftCMS 4. Everything works fine from PHP/MySQL side and I was also able to install all CraftCMS dependencies using composer and could run craft setup from console.
The only issue I have is that as soon as I run the Built-in-PHP Webserver or Apache server and try to access Craft CMS through localhost I get a errors saying headers already sent.
[web.ERROR] [yii\base\ErrorException:2] session_name(): Session name cannot be changed after headers have already been sent
This only happens if I try to access /craft/web... if I access another php file within the project it shows without issues.
So it seems like something CraftCMS specific maybe. Any ideas on what could cause this behaviour?
I have the following problem:
After trying to change the entry point to my website in the backend of my TYPO3 system (by using the site config), I cannot access neither my backend nor my frontend of the website anymore. Whenever I try to access the site it says "Oops, an error occurred! The parsedUri "https://" appears to be malformed".
What I have tried, is accessing the config.yaml on my webserver to change the baseURL inside of the config, but no matter what I change it to, it doesn't seem to work, as I always get the same error message even uploading the changed config file (what I mean by that is, that the text inside the error message doesn't change to reflect the new url but stays "https://").
I hope that someone who is more experienced in TYPO3 can help me solve this issue. I couldn't really find a working solution after extensively searching so far. Thanks a lot in advance.
After changing the yaml file of the site configuration, you need to clear all caches, either via the install tool (yourdomain.tld/typo3/install.php) or by deleting all files in the directories var/cache/code and var/cache/data.
I have set up a new nuget feed (company internal feed) and installing packages works without any isuues, but when I try to push a new version for a package, I get a 401 access denied.
What might be the problem?
Edit: To add some more context. I am using a MacOS machine, with a clear text password for the feed since encryption is not supported.
Solved by adding --valid-authentication-types basic in the source config.
I've been experimenting with single-spa for a while, and understand the basics of the developer experience. Create a parcel, yarn start on a unique port, add the reference to the import map declaration, and so on. The challenge with this is that as my root-config accrues more and more modules managing ports and import-maps starts to get tedious. What I want is to publish these modules to a central repository and load them from there (e.g., http://someserver.com/repository/moduleA/myorg-modulea.js, etc.).
I was recently introduced to localstack and started thinking maybe a local S3 bucket would serve for this. I have a configuration where builds (yarn build) are automatically published to an s3 bucket running on localstack. But when I try to load the root config index.html from the bucket I get the following JS error:
Unable to resolve bare specifier '#myorg/root-config'
I can access the JS files for each parcel and the root-config just fine via curl, so I suppose this would be a problem with any http server used in the same way. I can flip the root config to use the standard webpack-dev-server instead (on port 9000) and it works okay. So I'm guessing there's a difference between how a production build resolves these modules vs. the local build.
Has anyone tried something like this and got it working?
I had a similar issue that I got to work with http-server by adding each child .js file to a sub-folder in the root-config directory and launching the web server at the root-config directory level.
"imports": {
"#myorg/root-config": "http://someserver.com/root-config.js",
"#myorg/moduleA": "http://someserver.com/modules/moduleA/myorg-modulea.js",
"#myorg/moduleB": "http://someserver.com/modules/moduleB/myorg-moduleb.js",
"#myorg/moduleC": "http://someserver.com/modules/moduleC/myorg-modulec.js",
}
Note: By default, Single-SPA has an "isLocal" check before the current import mappings. You'll need to remove this if using a production build or it won't load the correct mappings.
<% if (isLocal) { %>
In my case, I was using localhost instead of someserver so I could navigate into the 'repository' folder and run npx http-server to get everything to run correctly.
I was hung up on this for a little while so hopefully this leads you in the right direction.
For the record, after trying several approaches to hosting a repository as described above, I found the unresolved bare specifier problem went away. So I have to chalk that up as just not having the right URL in the import map. Measure twice, cut once.
My team and I are working on creating a VSTS extension that will work with VSTS/Azure DevOps in the cloud, but the following 500 error is being thrown when trying to do a REST request:
HostAuthorizationNotFound
Microsoft.VisualStudio.Services.DelegatedAuthorization.SessionTokenCreateException
Here's the code:
// Get an instance of the client
var client = RestClient.getClient();
client.getWorkItem(10343, ["System.Title"]).then(
function(workItem) {
console.log(JSON.stringify(workItem))
},
function () {console.log("test")}
);
Uninstalling and reinstalling the extension has no effect, which seems to be the solution for others who have encountered this problem, and the extension scope was updated to include work items.
Additionally, the personal access token generated for my account works with the VSTS CLI. I'm able to create and query for work items with no issues there.
The Microsoft documentations mentions manual token creation for programs such as C# console apps, but my impression is that this should not be needed when working with an extension.
Is there something token related that needs to be explicitly declared in code?
The solution ended up being the same as what others have posted about: uninstalling and reinstalling the extension. In this case this was something that we tried initially but did not do entirely correctly -- the reinstallation did not take full effect since all the steps weren't followed (an admin also needed to approve the republishing of the extension).
So if you get this error, rest assured that uninstalling and reinstalling should do the trick!
See the following link for more details: https://learn.microsoft.com/en-us/azure/devops/extend/get-started/node?view=vsts#install-your-extension