Followed below steps:
I have created IAM user, where that user is attached to a Group and that Group has a policy set as AdministratorAccess.
I have configured awsmobile, using awsmobile configure, pasted creds from IAM user created above. Changed the region to us-east-2
While executing awsmobile init, I'm getting an error as below that contains us-east-1 as a region, but why.
backend awsmobile project creation error
{ NetworkingError: The header content contains invalid characters
at validateHeader (_http_outgoing.js:494:11)
at ClientRequest.setHeader (_http_outgoing.js:498:3)
at new ClientRequest (_http_client.js:173:14)
at Object.request (http.js:38:10)
at Object.request (https.js:239:15)
at features.constructor.handleRequest (C:\Users\manus\AppData\Roaming\npm\node_modules\awsmobile-cli\node_modules\aws-sdk\lib\http\node.js:42:23)
at executeSend (C:\Users\manus\AppData\Roaming\npm\node_modules\awsmobile-cli\node_modules\aws-sdk\lib\event_listeners.js:304:29)
at Request.SEND (C:\Users\manus\AppData\Roaming\npm\node_modules\awsmobile-cli\node_modules\aws-sdk\lib\event_listeners.js:318:9)
at Request.callListeners (C:\Users\manus\AppData\Roaming\npm\node_modules\awsmobile-cli\node_modules\aws-sdk\lib\sequential_executor.js:101:18)
at Request.emit (C:\Users\manus\AppData\Roaming\npm\node_modules\awsmobile-cli\node_modules\aws-sdk\lib\sequential_executor.js:77:10)
message: 'The header content contains invalid characters',
code: 'NetworkingError',
region: 'us-east-1',
hostname: 'mobile.us-east-1.amazonaws.com',
retryable: true,
time: 2018-04-28T15:26:56.753Z
Below is package.json file:
"dependencies": {
"amazon-cognito-identity-js": "^2.0.3",
"aws-amplify": "^0.3.3",
"aws-amplify-react": "^0.1.43",
"aws-sdk": "^2.228.1",
"react": "^16.3.2",
"react-dom": "^16.3.2",
"react-scripts": "1.1.4"
},
Node.js version: 8.11.1
awsmobile version: 1.1.1
npm version: 6.0.0
yarn version: 1.6.0
OS: Windows 10 VSCode: 1.22.2
Github Issue
It's working fine now.
I disabled firewall and copied creds using chrome developer tool and it worked. Then I re-enabled the firewall and tried again and it still worked. I thought problem was that I was copying the creds from AWS console itself, but then I tried to create a new user and copied from AWS console instead of chrome developer tool, and it also worked i.e everything is working now.
I also tried to create a new project by following https://github.com/aws-samples/aws-mobile-react-sample#getstarted and it also went well.
So, I can't recreate it now. Not sure what was the issue.
Related
I've used the Visual Studio template for .NetCore/React web app. By default, it runs in Development mode using IIS Express. However, if I set up a site in IIS, and a launch profile, I get an error in the browser:
AggregateException: One or more errors occurred. (One or more errors
occurred. (The NPM script 'start' exited without indicating that the
create-react-app server was listening for requests. The error output
was: Error: EPERM: operation not permitted, mkdir
'C:\Windows\system32\config\systemprofile\AppData\Roaming\npm'
My launchSettings.json has the following for the IIS profile:
"IIS": {
"commandName": "IIS",
"launchBrowser": true,
"launchUrl": "http://localhost",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
From the error, it looks like it may be a permission issue that I need to have the IIS app pool running under, but I can't find any documentation that tells me anything about that.
What am I missing? Again, this is an otherwise unmodified project from the template. The Startup.cs is running React as would be expected with:
app.UseSpa(spa =>
{
spa.Options.SourcePath = "ClientApp";
if (env.IsDevelopment())
{ spa.UseReactDevelopmentServer(npmScript: "start"); }
});
According to your description, I suggest you could firstly modify the IIS default application pool's identity to make sure it has the permission to run npm.
I suggest you could follow below steps:
1.Open the IIS management console, locate the application pool,find the default application pool and click the advanced setting.
Find the identity setting and modify the build-in account to localsystem
Then I suggest you could add the npm path in the system environment.
Go to Control Panel\System and Security\System and find advanced system settings
2.Click environment variable
3.Find the path inside the system variable and add the npm path as below:
C:\Users\{username}\AppData\Roaming\npm
developing API using typescript in node.js
importing the below package to use sql server database
import sql from "mssql/msnodesqlv8";
but this giving me the following error
Could not find a declaration for module 'mssql/msnodesqlv8'
implicitly has an any type. if it exists or add a new declaration (.d.ts) file
containing declare module 'mssql'
I have this declaration in almost every routing file and facing this ugly red color on every file showing me error because of this declaration.
The following packages are installed in my project
"msnodesqlv8": "^0.6.6",
"mssql": "^4.1.0",
"#types/mssql": "^4.0.7",
Any suggestions to get out of this?
I fixed this issue by running :
npm install mssql & npm install msnodesqlv8
my package.json look like this :
https://i.stack.imgur.com/7wMTk.png
connect to SQL Server and run query :
const connection = new sql.ConnectionPool({
server: *ServerName* ,
driver: 'msnodesqlv8',
options: {
trustedConnection: true
}})
connection.connect().then(()=> {
connection.query(`*Query*`,(err,result)=>{
if(err){
res.send(err);
}
else{
res.json(result)
}
})
})
So, I am developing React portlet for Liferay 7.0 CE. I have used blade command ( straight from the Liferay react template)
blade create -t npm-react-portlet -p fi.liferay.react.portlet -c ReactMain TestProject
Blade creates project as it should. After creation I changed to newly created project and ran
./gradlew build --stacktrace
First time build prints
npm WARN deprecated babel-preset-es2015#6.24.1: 🙌 Thanks for using Babel: we recommend using babel-preset-env now: please read babeljs.io/env to update!
And after that
Execution failed for task ':npmRunBuild'. > Process command '<pathToProject>/build/node/bin/node'' finished with non-zero exit value 1
-> Build failed.
When running again gradle build, build passes
When deploying to Liferay portal, browser console prints
ReferenceError: module is not defined[Learn More]
combo:1:1
Error: Load timeout for modules: TestProject#1.0.0
Stack trace:
require/</</s<#http://localhost:8080/o/frontend-js-web/everything.jsp?browserId=firefox&themeId=classic_WAR_classictheme&colorSchemeId=01&minifierType=js&minifierBundleId=javascript.everything.files&languageId=en_US&b=7004&t=1521557570840:288:322
I am using npm version 5.6.0 and Node version 9.8.0 . Blade CLI version is 2.3.1.201711201552
Operating system is MacOs High Sierra Version 10.13.3
I have tried with new portal and with Google Chrome and Mozilla firefox
It caused by the upgrade of liferay npm build tools.
It will be fixed after the new release of blade cli.
And you can also fix it by change your package.json file like the following:
{
"dependencies": {
"react": "15.6.2",
"react-dom": "15.6.2"
},
"devDependencies": {
"babel-cli": "6.26.0",
"babel-preset-es2015": "6.24.1",
"babel-preset-liferay-project": "1.6.1",
"babel-preset-react": "6.24.1",
"liferay-npm-bundler": "1.6.1",
"liferay-npm-bundler-preset-react": "1.6.1"
},
"main": "js/index.js",
"name": "npm-react-portlet70",
"scripts": {
"build": "babel --source-maps -d build/resources/main/META-INF/resources src/main/resources/META-INF/resources && liferay-npm-bundler"
},
"version": "1.0.0"
}
Hope that can fix your problem.
following the instructions to setup a salesforce dx prject, I get the error:
ERR_ASSERTION: A name parameter is required to create a storage
when using the command:
sfdx force:project:create --projectname mywork
I'm using Ubuntu 16.04 (Xubuntu).
I don't get any hits on google when searching for "ERR_ASSERTION: A name parameter is required to create a storage" so any clues regarding that error will be helpful.
Just as an update, I was running into the same problem and the issue was that there was a package.json in the root folder that shouldn't be there. Once deleted, the create-project process went through ok.
adding package.json with the contents
{
"name": "<anything I choose>"
}
Seems to allow it to work without the Mentioned Error (Although I have no Idea how that package.json should be written otherwise).
more related info on the github issue
I'm trying to set up E2E testing on one of my windows asp.net (mvc->angular)projects.
We use team city to do our builds so I want my configuration to work on my box and on the build box.
I'm stuck trying to set up the values in conf.js so that protractor will automatically start up and stop when protractor needs it...
I run it via a batch file like this:
call npm install -g
call C:\Users\brown.ericw\AppData\Roaming\npm\protractor conf.js
pause
Everything was working fine when I was running selenium manually.
But I just can't figure out the right conf.js to get selenium started and shut down automatically(Stopping it in the bat file was not always effective, despite several different approaches).
I've tried lots of different combos, but I'm stumped.
Here is the relevant portion of my conf.js:
exports.config = {
seleniumjar: '.\node_modules\protractor\selenium\selenium-server-standalone-2.45.0.jar',
//seleniumArgs: '-Dwebdriver.chrome.driver="\node_modules\protractor\selenium\chromedriver',
//chromeDriver: '.\node_modules\protractor\selenium\chromedriver',
//chromeDriver: '.\node_modules\protractor\bin\webdriver-manager',
chromeDriver: 'C:\Users\Brown.ericw\AppData\Roaming\npm\node_modules\protractor\selenium\chromedriver',
//seleniumAddress: 'http://localhost:4444/wd/hub',
specs: [
'e2eTests/*.js'
],
I have protractor installed under my project folder, so I run npm install, so I know it's all kosher at the beginning of the run on the build/test server.
Here is the error I'm getting.. Clearly I can't I figure out the setting to get get it pointing towards the chrome driver...
D:\TFS\TACAdmin3G_Test_E2E>call
C:\Users\brown.ericw\AppData\Roaming\npm\protra ctor conf.js
[launcher] Process exited with error code 1
C:\Users\Brown.ericw\AppData\Roaming\npm\node_modules\protractor\node_modules\q\
q.js:126
throw e;
^ Error: Could not find chromedriver at D:\TFS\TACAdmin3G\node_modules\protractor\ selenium\chromedriver
at LocalDriverProvider.addDefaultBinaryLocs_ (C:\Users\Brown.ericw\AppData\R
oaming\npm\node_modules\protractor\lib\driverProviders\local.js:54:15)
at LocalDriverProvider.setupEnv (C:\Users\Brown.ericw\AppData\Roaming\npm\no
de_modules\protractor\lib\driverProviders\local.js:71:8)
at Runner.run (C:\Users\Brown.ericw\AppData\Roaming\npm\node_modules\protrac
tor\lib\runner.js:265:31)
at TaskRunner.run (C:\Users\Brown.ericw\AppData\Roaming\npm\node_modules\pro
tractor\lib\taskRunner.js:123:19)
at createNextTaskRunner (C:\Users\Brown.ericw\AppData\Roaming\npm\node_modul
es\protractor\lib\launcher.js:220:20)
at C:\Users\Brown.ericw\AppData\Roaming\npm\node_modules\protractor\lib\laun
cher.js:243:7
at _fulfilled (C:\Users\Brown.ericw\AppData\Roaming\npm\node_modules\protrac
tor\node_modules\q\q.js:797:54)
at self.promiseDispatch.done (C:\Users\Brown.ericw\AppData\Roaming\npm\node_
modules\protractor\node_modules\q\q.js:826:30)
at Promise.promise.promiseDispatch (C:\Users\Brown.ericw\AppData\Roaming\npm
\node_modules\protractor\node_modules\q\q.js:759:13)
at C:\Users\Brown.ericw\AppData\Roaming\npm\node_modules\protractor\node_mod
ules\q\q.js:573:44
I tried changing the slashes because of the space in the path up there and it changed back to the normal path:
Error: Could not find chromedriver at D:\TFS\TACAdmin3G\_Test_E2E\..
which doesn't give me the whole path.
chromedriver.exe is in all the locations in the various commented version in the conf.js. but no joy truing each of them.
I need to use relative pathing because the root folder on my box is different than the one on the build server.
Any help is greatly appreciated.
Forgot to say I looked at this one:Protractor does not find chromedriver: The driver executable does not exist:
and this one
how to close selenium webdriver at end of test?
and wasn't able to figure it out
Okay every body, for those who follow ,here is the answer to the problem and why I think this is what works. This answer works in my node.js project in VS(have to add the packages here too) , in a batch file on my dev box, and in team city.
I added NPM INSTALL to my build script, so that once the code is pulled down it immediately puts all the js packages in the code directories.
Then I added the selenium server stand lone package to my project(and package.json so I knew exactly where the jar is. I added it as a --Save(write to config)and as a --Dev (add in the dev section, ie include in node_models in my code folders)
Then I have this in my conf.js
> exports.config = {
> seleniumServerJar: 'node_modules/selenium-server-standalone-jar/jar/selenium-server-standalone-2.45.0.jar',
> chromeDriver: './node_modules/protractor/selenium/chromedriver',
> //seleniumAddress: 'http://localhost:4444/wd/hub',
There are several subtle but important changes.
1
seleniumServerJar vs seleniumjar - there are a lot of examples out there using seleniumjar... so I'm guessing the standard tag changed at some point, but seleniumServerJar is what is shown on the documentation pages and it's what works.
2
/ vs \ as the slash in paths.. this one was tricks because when I used backslash, it didn't complain, the only difference was it truncated the path with a ... in the error messages, but when i dug in deeper, backslashes are getting removed from the part of the path you enter... even the part the code uses based on .\ has back slashes... so only use forward slashes in paths in these tags in conf.js
3
Relative pathing with ../node_modules vs .\node_modules vs node_modules..., there are examples out there with all of these used, once I was able to see the full paths being generated I figured out that ../ wasn't what I wanted.. so I played with it and got it working with one ./ and one nothing... why they both didn't work with ./ I don't know.. but it works.(sorry about that)
Just in case it helps you here is my package.json
{
"name": "_Test_e2e",
"version": "0.0.0",
"description": "_Test_e2e",
"main": "app.js",
"author": {
"name": "Brown.EricW",
"email": ""
},
"devDependencies": {
"jasmine-reporters": "^1.0.0",
"protractor": ">=0.14.0-0 <1.0.0",
"selenium-server-standalone-jar": "^2.45.0"
},
"scripts": {
"postinstall": "webdriver-manager update"
},
"dependencies": {
"jasmine": "^2.3.1",
"jasmine-reporters": "^1.0.0",
"protractor": "^2.1.0"
}
}
Running real browsers on build server probably isn't a good solution. If you have a dedicated Teamcity node, then a headless browser implementation like PhantomJS could be an option. You need to make sure that PhantomJS is installed on your dedicated node and its executable is placed somewhere in the PATH. Also make sure to set browser name to be phantomjs instead of chrome.
Secondly you could setup a Selenium grid and setup nodes with different browsers you want to test. From build server you would run tests on the remote selenium grid on the browser of your choice. There are paid, third part options like sauce labs or browser stack if you wish to go that route.
I would tend to go with second option since PhantomJS is not a real browser and you may have requirement of testing your application on different browsers/platforms etc.