Can't deploy create-react-app application on GitHub Pages - github

I followed all the steps necessary to deploy my create-react-app application (in conjunction with react-router-dom, redux, and react-redux) here, but my app is not displaying anything but the footer.
I went to check out the console, but the console is completely clean of errors. Here is the homepage code I put in my package.json file.
package.json
"name": "flags-of-the-world-redux",
"homepage": "https://bnikkhah.github.io/flags-of-the-world-redux/",
[...],
"scripts": {
[...],
"predeploy": "yarn run build",
"deploy": "gh-pages -d build"
},
Here is my router:
CountryRouter.jsx
export default () => (
<BrowserRouter>
<Switch>
<Route exact={ true } path="/" component={ CountriesPage } />
<Route path="/country/:name" component={ CountryPage } />
<Route path="/compare" component={ CompareCountryList } />
</Switch>
<Footer />
</BrowserRouter>
)
Note: my footer component displays correctly, but anything within the Switch are not displayed on my GitHub page.
Would anyone have any idea what other steps I need to follow in order to successfully deploy my React + Redux app?

Hey guys I decided to go with deploying on Heroku instead. I followed this YouTube video to get me started. If anybody would like to view my app, feel free here!

Related

External string does not exist error while trying to deploy through Jenkins

We have repo with salesforce code. Goal is to deploy it to scratch org and launch tests.
Below is the error as we are getting while running a Jenkins pipeline for common libraries.
Error src/main/java/com/spartasystems/twd/security/PermissionGuard.cls External string does
not exist: PERMISSION_DENIED_AN_OBJECT (27:82)
Error src/main/java/com/spartasystems/twd/security/PermissionGuard.cls External string does
not exist: PERMISSION_DENIED_A_FIELD (29:82)
ERROR running force:source:deploy: Deploy failed.
My deploy code looks like as shows below:
stage('MDAPI Deploy To Scratch Org'){
sh 'ls -al'
sh 'cat sfdx-project.json'
sh 'cat src/labels/*'
SFDX.deployMDAPISourceCodeToScratchOrg("./abc/src/");
SFDX.deployMDAPISourceCodeToScratchOrg("./xyz/src/");
sh 'rm src/main/java/com/company/twd/util/DebuggingUtil'
sh 'sfdx force:source:deploy -x src/main/resources/package.xml'
}
Here is the package.xml file
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
<types>
<members>*</members>
<name>ApexClass</name>
</types>
<types>
<members>*</members>
<name>CustomObject</name>
</types>
<types>
<members>*</members>
<name>CustomLabels</name>
</types>
<version>49.0</version>
</Package>
Can anyone help me here as I am stuck and unable to fix this issue ?
I have got a response from Salesforce Stack Exchange that this might be something related to third-party java library . I am unable to understand whether there is an issue with Labels missing in Salesforce org or what else.
Kindly help me with this.
If you are using custom label then 'Custom label' must already exist in targeting environment(where you are deploying the code through Jenkins).
I don't think you understand my question from comments.
If the apex class PermissionGuard contains references like Label.PERMISSION_DENIED_AN_OBJECT then:
that "custom label" must already exist in the target environment
or your deployment must be creating that custom label in the same action that creates/updates this class.
It's not a Jenkins problem. You're pulling the files from some Git repo or locally on filesystem? If the developer committed to Git only the class but not the custom labels file - shout at the dev that this is not deployable. Whether to scratch org, to sandbox or to production.
The labels\CustomLabels.labels file will look similar to this
<?xml version="1.0" encoding="UTF-8"?>
<CustomLabels xmlns="http://soap.sforce.com/2006/04/metadata">
<labels>
<fullName>CommunityAccessSuspended</fullName>
<categories>Community, Login</categories>
<language>en_US</language>
<protected>false</protected>
<shortDescription>CommunityAccessSuspended</shortDescription>
<value>Your access is disabled. Please contact your site administrator.</value>
</labels>
</CustomLabels>
If the dev doesn't know how to download the fresh file from org, sfdx force:mdapi:retrieve -r ./mdapi -u yourUsername#yourCompany.com -k ./path/to/package.xml should be a good start.

IONIC: How can I make application to never exit but to work in background, or how can I call a function on app exit?

I'm using IONIC to build one application. I'm using cordova background mode package. I manage to make it to work in background, when display is turned of and etc. I'm also using Power Management package from cordova.
My code in app.component file is like below:
initializeApp() {
this.platform.ready().then(() => {
this.statusBar.styleDefault();
this.splashScreen.hide();
this.statusBar.overlaysWebView(true);
this.statusBar.isVisible = true;
this.statusBar.show();
this.backgroundMode.enable();
this.powerManagement.acquire()
.then(() => {
})
.catch(() => {
});
});
}
In my AndroidManifest.xml I'm using code like this:
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
But when I close my application from opened applications list it kills application and doesn't proceed to run in background.
What should I do?

Flutterwave Integration with Ionic 4

Invalid Public Key Passed
please am having issue during payment process, this is what i received
"invalid public key passed"
The api has been returning this error for days now, what is the problem? i am using the live pubkey and secret key from my dashboard.
this.rave.Card.charge(
{
"PBFPubKey":"FLWPUBK-33223e3cd910016924752a8373518225-X",
"cardno": "5438898014560229",
"cvv": "564",
"expirymonth": "10",
"expiryyear": "20",
"currency": "NGN",
"country": "NG",
"amount": "10",
"email": "user#gmail.com",
"phonenumber": "0902620185",
"firstname": "temi",
"lastname": "desola",
"IP": "355426087298442",
"txRef": "MC-" + Date.now(),// your unique merchant reference
"meta": [{ metaname: "flightID", metavalue: "123949494DC" }],
"redirect_url": "https://rave-webhook.herokuapp.com/receivepayment",
"device_fingerprint": "69e6b7f0b72037aa8428b70fbe03986c"
}
).then(resp => {
console.log(resp.body);
this.rave.Card.validate({
"transaction_reference": resp.body.data.flwRef,
"otp": 12345
}).then(response => {
console.log(response.body.data.tx);
console.log(response.body);
})
}).catch(err => {
console.log(err);
})
Step 1 : Get the Flutterwave-Angular-v3 here [https://github.com/Flutterwave/Flutterwave-Angular-v3]
run either of these commands depending on your runtime
environment
npm install flutterwave-angular-v3
or
yarn add flutterwave-angular-v3
step 2 : Import FlutterwaveModule to the app root module i.e. app.module.ts file and declare it in your imports array.
import { FlutterwaveModule } from "flutterwave-angular-v3"
#NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
FlutterwaveModule
],
providers: [],
bootstrap: [AppComponent]
})
you have 2 options to either
use in code or use as a component, depending on
the architectural pattern of your application.
the README.md on the link is well explanatory.
step 3 : for the purpose of this question choose
Use in Code, Method 2 (Promise): Async Payment Response
import {Component} from '#angular/core';
import {Flutterwave, AsyncPaymentOptions} from "flutterwave-angular-v3"
(so you are able to get a promise back and do whatever you wish programmatically with your response data)..
Now fire up chrome and test your application, this should work fine on chrome when pay button is clicked prompting up the https://flutterwave.com/ng/ payment page modal,
P:S if you are building Natively (i.e. on device), you might encounter issues, worthy of note is running into an infinite loop when you click on the pay button, and you have a white blank screen that just keeps showing the loading icon.. resolve this by whitelisting https://cordova.apache.org/docs/en/9.x/reference/cordova-plugin-whitelist/ in your Config.xml file .....
Kindly ensure that these configs are included in the config.xml file :
<access origin="*" subdomains="true" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-navigation href="*" />
after this, delete your respective platform build folder and rebuild i.e.
ionic cordova build android
OR
ionic cordova build ios
now serve your project again and start testing, this should work fine on your device or simulator perfectly now. incase you get different error reach out on their forum https://developer.flutterwave.com/discuss, you sure will get an answer within record timing, their Engineers are doing an Amazing job..
if you get this working consider yourself approved the status of Jedi, and please mark this answer.
make sure you go to your dashboard and under settings->API the copy the public key.
Also note that the package was built for ionic 3 and not ionic 4.
you can use this package for ionic 4 [rave ionic 4] (https://www.npmjs.com/package/rave-ionic4).
I updated the current one for ionic 3 to work for ionic 4

Consuming OData from Eclipse

I've been practicing SAPUI5 with the documentation but they use SAP Web IDE to consume OData services. However, because my company won't expose their server to the cloud, I can't use SAP Web IDE so I need to use eclipse. I need a tutorial step by step (for dummies) for consuming OData with SAPUI5 from eclipse. I already know how to create them but not how to use them from eclipse.
I use the OData service from Northwind but with SAP, I'll need credentials and other things.
"dataSources": {
"invoiceRemote": {
"uri": "https://services.odata.org/V2/Northwind/Northwind.svc/",
"type": "OData",
"settings": {
"odataVersion": "2.0"
}
}
}
[...] because they won't expose their server to the cloud, I can't use SAP Web IDE
An alternative to the clould based Web IDE is the Web IDE Personal Edition which you can deploy on your local machine but still runs in the browser (localhost). Create a corresponding destination file to connect to remote systems and the rest is pretty much the same as the old Orion-based Web IDE on the cloud.
Here is the destination file for the services from odata.org (e.g. Northwind)
Description=OData service from odata.org for testing, tutorials, demos, etc.
Type=HTTP
Authentication=NoAuthentication
WebIDEUsage=odata_gen
Name=odata_org
WebIDEEnabled=true
URL=http\://services.odata.org/
ProxyType=Internet
WebIDESystem=odata_org
Otherwise, if you want to stick with eclipse, take a look at the documentation topic
App Development Using SAPUI5 Tools for Eclipse
and its underlying topic Use a SimpleProxyServlet for Testing to
Avoid Cross-domain Requests
An exmaple using th OData of northwind: (this i made it in eclipse but the only differece with sap web ide personal edition (i haven't try this yet but it should work) you must configure the destination file for the services)
manifest.json
//between sap.app key you put this:
"dataSources": {
"mainService": {
"uri": "/northwind/V2/OData/OData.svc/",
"type": "OData",
"settings": {
"odataVersion": "2.0",
"localUri": "localService/metadata.xml"
}
}
}
...
// this can be empty the if your using more than two just one can be empty
"": {
"dataSource": "mainService",
"preload": true
}
In my view that i'm going to use the data:
<List
id="list"
items="{
path: '/Categories',
sorter: {
path: 'Name',
descending: false
},
groupHeaderFactory: '.createGroupHeader'
}"
busyIndicatorDelay="{masterView>/delay}"
noDataText="{masterView>/noDataText}"
mode="{= ${device>/system/phone} ? 'None' : 'SingleSelectMaster'}"
growing="true"
growingScrollToLoad="true"
updateFinished="onUpdateFinished"
selectionChange="onSelectionChange">
<infoToolbar>
<Toolbar
active="true"
id="filterBar"
visible="{masterView>/isFilterBarVisible}"
press="onOpenViewSettings">
<Title
id="filterBarLabel"
text="{masterView>/filterBarLabel}" />
</Toolbar>
</infoToolbar>
<items>
<ObjectListItem
type="Active"
press="onSelectionChange"
title="{Name}">
</ObjectListItem>
</items>
</List>
If you're going to use and odata made for you or consume just paste the url in the propertie "uri" of yo key dataSource (something like this: "https://proxy/name:port/sap/opu/odata/SAP/ZNAME_OF_YOUR_CREATED_ODATA_SRV" don't worry this url is you could see it when yo /IWFND/MAINT_SERVICE ) and when is already to deploy it just leave the uri like this /sap/opu/odata/SAP/ZNAME_OF_YOUR_CREATED_ODATA_SRV
I'll give you some lights, but not a full tutorial.
Working in eclipse is not that different from working with WEB IDE.
First you need to use JSONModel(). You can find reference here.
Create a JSONModel object and then use the method loadData.
For the sURL use (in your example):
"https://services.odata.org/V2/Northwind/Northwind.svc/?$format=json"
Then, you will have your oData in your front end. Now you just need to learn how to use it in your view elements. That you can learn it here.
If you want further explanations, please make small and specific questions, so it is easier to answer directed to your needs.

App works locally but not on Heroku (Application Error); Using Nodemon and Webpack

Alright, I've tried to look up my question on StackOverflow but I can't find something that helps me since everything I've tried doesn't have any effect on the result (Application error).
So I'm really stumped because the app works perfectly fine on my localhost, but I can't get it to work on Heroku, it just gives me a Application error so I have no idea what the issue is.
So on my package.JSON file looks like this:
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "nodemon --use_strict index.js",
"bundle": "webpack"
},
And I've already tried to change "nodemon" to "node" and gotten rid of --use_strict and ran it on local host and it still works perfectly fine but the Heroku app still gives me a Application Error.
index.js the only thing that I can think of being bad (changed it and it runs here):
// start the server
app.listen(3000, () => {
console.log('Server is running.');
});
webpack.config.js:
const path = require('path');
module.exports = {
// the entry file for the bundle
entry: path.join(__dirname, '/client/src/app.jsx'),
// the bundle file we will get in the result
output: {
path: path.join(__dirname, '/client/dist/js'),
filename: 'app.js',
},
module: {
// apply loaders to files that meet given conditions
loaders: [{
test: /\.jsx?$/,
include: path.join(__dirname, '/client/src'),
loader: 'babel-loader',
query: {
presets: ["react", "es2015"]
}
}],
},
// start Webpack in a watch mode, so Webpack will rebuild the bundle on changes
watch: true
};
It deployed properly after git push heroku master:
https://c1.staticflickr.com/3/2873/33519283263_3d9a711311_z.jpg
I'm pretty much trying to make this app work on Heroku:
https://vladimirponomarev.com/blog/authentication-in-react-apps-creating-components
I think a possible problem might be that you have to run "run bundle" on one shell and "npm start" in the other shell.
Another thing, this app had a lot of things that were npm installed manually in node_modules, which Heroku does not accept if I try to push it on github and will crash, so I'm thinking that might be an issue as well, though I have no idea how to get around that.
This also uses Express and Mongodb, and I added my mongodb info into the index.json file and ran the application, and it worked perfectly fine and after checking the db, the correct info was also inside it, so it's not that either.
You should use process.env.PORT instead of custom port 3000.
Check that you have a mongodb addon purchased, you can get one for free but for limited spacing!
And use the config vars of that database, if you haven't done that already!