Access-Control-Allow-Origin on SAPUI5 today - sapui5

I have been running a SAP UI5 application for a year with out any problems. But today it changed and gave me Access-Control-Allow-Origin.
This the code. I have only tried to change the version but it does not help.
<script
id="sap-ui-bootstrap"
src="https://sapui5.netweaver.ondemand.com/1.38.12/resources/sap-ui-core.js"
data-sap-ui-theme="sap_bluecrystal"
data-sap-ui-libs="sap.ui.commons,sap.ui.layout, sap.ui.table,sap.m,sap.ui"
data-sap-ui-xx-bindingSyntax="complex"
data-sap-ui-resourceroots='{"VendorApprovalComponent.DO_OrgTransord" : "./" }' >
</script>
The errors that I'm getting is the following.
XMLHttpRequest cannot load sapui5.netweaver.ondemand.com/1.38.12/resources/sap/ui/layout/library-preload.json.
No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'CUSTOMERURL' is therefore not allowed access.
The response had HTTP status code 404.send # sap-ui-core.js:126ajax # sap-ui-core.js:126q.sap.preloadModules # sap-ui-core.js:174(anonymous function) # sap-ui-core.js:174each # sap-ui-core.js:115q.sap.registerPreloadedModules # sap-ui-core.js:174success # sap-ui-core.js:174p # sap-ui-core.js:126fireWith # sap-ui-core.js:126h3 # sap-ui-core.js:126(anonymous function) # sap-ui-core.js:126send # sap-ui-core.js:126ajax # sap-ui-core.js:126q.sap.preloadModules # sap-ui-core.js:174(anonymous function) # sap-ui-core.js:833each # sap-ui-core.js:115constructor # sap-ui-core.js:833(anonymous function) # sap-ui-core.js:949applyAMDFactoryFn # sap-ui-core.js:174(anonymous function) # sap-ui-core.js:174t1 # sap-ui-core.js:174sap.ui.define # sap-ui-core.js:174s1 # sap-ui-core.js:174r1 # sap-ui-core.js:174q.sap.require # sap-ui-core.js:174(anonymous function) # sap-ui-core.js:1761
sap-ui-core.js:160 2016-11-03 11:32:52.176935 failed to preload 'sap.ui.layout.library-preload': NetworkError: Failed to execute 'send' on
My webserver is a SAP NW JAVA server running behind a ICM firewall.

Related

Error with MakeStyles when rebuilding a react app

I am migrating my react front that was previously rendered along rails with react-rails to a separate react application build from scratch, when adding a component that makes use of makeStyles I get the following error:
makeStyles.js:156 Uncaught TypeError: Cannot read properties of undefined (reading 'refs')
at detach (makeStyles.js:156:1)
at makeStyles.js:240:1
at makeStyles.js:194:1
at safelyCallDestroy (react-dom.development.js:22932:1)
at commitHookEffectListUnmount (react-dom.development.js:23100:1)
at commitPassiveUnmountOnFiber (react-dom.development.js:25031:1)
at commitPassiveUnmountEffects_complete (react-dom.development.js:25007:1)
at commitPassiveUnmountEffects_begin (react-dom.development.js:24996:1)
at commitPassiveUnmountEffects (react-dom.development.js:24941:1)
at flushPassiveEffectsImpl (react-dom.development.js:27038:1)
detach # makeStyles.js:156
(anonymous) # makeStyles.js:240
(anonymous) # makeStyles.js:194
safelyCallDestroy # react-dom.development.js:22932
commitHookEffectListUnmount # react-dom.development.js:23100
commitPassiveUnmountOnFiber # react-dom.development.js:25031
commitPassiveUnmountEffects_complete # react-dom.development.js:25007
commitPassiveUnmountEffects_begin # react-dom.development.js:24996
commitPassiveUnmountEffects # react-dom.development.js:24941
flushPassiveEffectsImpl # react-dom.development.js:27038
flushPassiveEffects # react-dom.development.js:26984
(anonymous) # react-dom.development.js:26769
workLoop # scheduler.development.js:266
flushWork # scheduler.development.js:239
performWorkUntilDeadline # scheduler.development.js:533
(I am using the 4.12 version of material ui)

snmpget : Unknown user name

I am trying to install net-snmp from scratch to make snmpv3 to work on my computer.
I did install net-snmp and create the user, but when I want to make snmpget it reject me with snmpget: Unknown user name
To install net-snmp I followed the official guide
I did install the packages libperl-dev, snmp-mibs-downloader and snmp too using sudo apt-get install
Here is my /usr/local/share/snmp configuration where you can find the particular line rouser neutg
###############################################################################
#
# EXAMPLE.conf:
# An example configuration file for configuring the Net-SNMP agent ('snmpd')
# See the 'snmpd.conf(5)' man page for details
#
# Some entries are deliberately commented out, and will need to be explicitly activated
#
###############################################################################
#
# AGENT BEHAVIOUR
#
# Listen for connections from the local system only
# agentAddress udp:127.0.0.1:161
# Listen for connections on all interfaces (both IPv4 *and* IPv6)
agentAddress udp:161,udp6:[::1]:161
###############################################################################
#
# SNMPv3 AUTHENTICATION
#
# Note that these particular settings don't actually belong here.
# They should be copied to the file /var/lib/snmp/snmpd.conf
# and the passwords changed, before being uncommented in that file *only*.
# Then restart the agent
# createUser authOnlyUser MD5 "remember to change this password"
# createUser authPrivUser SHA "remember to change this one too" DES
# createUser internalUser MD5 "this is only ever used internally, but still change the password"
# If you also change the usernames (which might be sensible),
# then remember to update the other occurances in this example config file to match.
###############################################################################
#
# ACCESS CONTROL
#
# system + hrSystem groups only
view systemonly included .1.3.6.1.2.1.1
view systemonly included .1.3.6.1.2.1.25.1
# Full access from the local host
#rocommunity public localhost
# Default access to basic system info
rocommunity public default -V systemonly
# rocommunity6 is for IPv6
rocommunity6 public default -V systemonly
# Full access from an example network
# Adjust this network address to match your local
# settings, change the community string,
# and check the 'agentAddress' setting above
#rocommunity secret 10.0.0.0/16
# Full read-only access for SNMPv3
rouser authOnlyUser
# Full write access for encrypted requests
# Remember to activate the 'createUser' lines above
#rwuser authPrivUser priv
# It's no longer typically necessary to use the full 'com2sec/group/access' configuration
# r[ow]user and r[ow]community, together with suitable views, should cover most requirements
###############################################################################
#
# SYSTEM INFORMATION
#
# Note that setting these values here, results in the corresponding MIB objects being 'read-only'
# See snmpd.conf(5) for more details
sysLocation Sitting on the Dock of the Bay
sysContact Me <me#example.org>
# Application + End-to-End layers
sysServices 72
#
# Process Monitoring
#
# At least one 'mountd' process
proc mountd
# No more than 4 'ntalkd' processes - 0 is OK
proc ntalkd 4
# At least one 'sendmail' process, but no more than 10
proc sendmail 10 1
# Walk the UCD-SNMP-MIB::prTable to see the resulting output
# Note that this table will be empty if there are no "proc" entries in the snmpd.conf file
#
# Disk Monitoring
#
# 10MBs required on root disk, 5% free on /var, 10% free on all other disks
disk / 10000
disk /var 5%
includeAllDisks 10%
# Walk the UCD-SNMP-MIB::dskTable to see the resulting output
# Note that this table will be empty if there are no "disk" entries in the snmpd.conf file
#
# System Load
#
# Unacceptable 1-, 5-, and 15-minute load averages
load 12 10 5
# Walk the UCD-SNMP-MIB::laTable to see the resulting output
# Note that this table *will* be populated, even without a "load" entry in the snmpd.conf file
###############################################################################
#
# ACTIVE MONITORING
#
# send SNMPv1 traps
trapsink localhost public
# send SNMPv2c traps
#trap2sink localhost public
# send SNMPv2c INFORMs
#informsink localhost public
# Note that you typically only want *one* of these three lines
# Uncommenting two (or all three) will result in multiple copies of each notification.
#
# Event MIB - automatically generate alerts
#
# Remember to activate the 'createUser' lines above
iquerySecName internalUser
rouser internalUser
# generate traps on UCD error conditions
defaultMonitors yes
# generate traps on linkUp/Down
linkUpDownNotifications yes
###############################################################################
#
# EXTENDING THE AGENT
#
#
# Arbitrary extension commands
#
extend test1 /bin/echo Hello, world!
extend-sh test2 echo Hello, world! ; echo Hi there ; exit 35
#extend-sh test3 /bin/sh /tmp/shtest
# Note that this last entry requires the script '/tmp/shtest' to be created first,
# containing the same three shell commands, before the line is uncommented
# Walk the NET-SNMP-EXTEND-MIB tables (nsExtendConfigTable, nsExtendOutput1Table
# and nsExtendOutput2Table) to see the resulting output
# Note that the "extend" directive supercedes the previous "exec" and "sh" directives
# However, walking the UCD-SNMP-MIB::extTable should still returns the same output,
# as well as the fuller results in the above tables.
#
# "Pass-through" MIB extension command
#
#pass .1.3.6.1.4.1.8072.2.255 /bin/sh PREFIX/local/passtest
#pass .1.3.6.1.4.1.8072.2.255 /usr/bin/perl PREFIX/local/passtest.pl
# Note that this requires one of the two 'passtest' scripts to be installed first,
# before the appropriate line is uncommented.
# These scripts can be found in the 'local' directory of the source distribution,
# and are not installed automatically.
# Walk the NET-SNMP-PASS-MIB::netSnmpPassExamples subtree to see the resulting output
#
# AgentX Sub-agents
#
# Run as an AgentX master agent
master agentx
# Listen for network connections (from localhost)
# rather than the default named socket /var/agentx/master
#agentXSocket tcp:localhost:705
rouser neutg
Here is my persistant configuration file /var/net-snmp/snmpd.conf
createUser neutg SHA "password" AES passphrase
The command I run is :
snmpget -u neutg -A password -a SHA -X 'passphrase'
-x AES -l authPriv localhost -v 3 1.3.6.1.2.1.1
I don't understand why it do not take in count my user. (I did restart the snmpd after entering the user - multiple times!)
The version of net-snmp I use :
Thanks in advance :)
After many research I've found what the problem is.
snmpd was not taking in count my configuration files. I saw it using the command :
snmpd -Dread_config -H 2>&1 | grep "Reading" | sort -u
Which tells you which configurations files are loaded by snmpd.
You can see it as well looking at the configuration file /var/lib/snmp/snmpd.conf. When snmpd handle your users it creates special lines in the file. It looks like :
usmUser 1 3 0x80001f888074336938f74f7c5a00000000 "neutg" "neutg" NULL .1.3.6.1.6.3.10.1.1.3 0xf965e4ab0f35eebb3f0e3b30\
6bc0797c025821c5 .1.3.6.1.6.3.10.1.2.4 0xe277044beccd9991d70144c4c8f4b672 0x
usmUser 1 3 0x80001f888074336938f74f7c5a00000000 "myuser" "myuser" NULL .1.3.6.1.6.3.10.1.1.2 0x2223c2d00758353b7c3076\
236be02152 .1.3.6.1.6.3.10.1.2.2 0x2223c2d00758353b7c3076236be02152 0x
setserialno 1424757026
So if you do not see any usmUser it's probably that your badly added your users.
The soluce
sudo /usr/local/sbin/snmpd -c /var/net-snmp/snmpd.conf -c /usr/local/share/snmp/snmpd.conf

Remove markup in tests

When I run tests which fail I get a huge output with a lot of markup hiding the error.
Example:
$ perl script/my_prove.pl t/2410-topinfo.t
t/2410-topinfo.t .. 1/?
# Failed test '200 OK'
# at t/2410-topinfo.t line 12.
# got: '500'
# expected: '200'
# Failed test 'similar match for selector "h1"'
# at t/2410-topinfo.t line 12.
# ''
# doesn't match '(?^:Flatinfo\ Business\-Apartment\ Hietzing)'
# Failed test 'content is similar'
# at t/2410-topinfo.t line 12.
# '<!DOCTYPE html>
# <html>
# <head>
# <title>Server error (development mode)</title>
# <meta http-equiv="Pragma" content="no-cache">
# <meta http-equiv="Expires" content="-1">
# <script src="/mojo/jquery/jquery.js"></script>
# <script src="/mojo/prettify/run_prettify.js"></script>
# <link href="/mojo/prettify/prettify-mojo-dark.css" rel="stylesheet">
# <style>
# a img { border: 0 }
# body {
#
# ........... lots of lines removed here ...........
#
# <div id="wrapperlicious">
# <div id="nothing" class="box spaced"></div>
# <div id="showcase" class="box code spaced">
# <pre id="error">Can't call method "name" on an undefined value at template extern/topinfo/show.html.ep line 2.
# </pre>
#
# .... lots of lines follow here ............
The error seems to be a single line:
Can't call method "name" on an undefined value at template extern/topinfo/show.html.ep line 2
The test-script producing this output is:
use Mojo::Base -strict;
use Test::More;
use Test::Mojo;
use FindBin;
require "$FindBin::Bin/../script/ba_db";
my $t = Test::Mojo->new( 'BaDb' );
$t->ua->max_redirects(1);
$t->get_ok('/info/penx2')
->status_is(200)
->text_like('h1' => qr/\QFlatinfo Business-Apartment Hietzing\E/)
->content_like( qr/\QSelected language: German\E/ )
# ...
;
done_testing();
Is there a way to tell Mojolicious to respond without all this HTML-Markup so that I can see the error-mesage immediately?
There are two things at play here.
The large debug output with the full page source is because the content_like method from Test::Mojo didn't find a match, and it's telling you in which string it was looking. That's a convenience method, but if the page is large, it's a lot of text. This might tell you that the test failed because the content was wrong. But in this specific case it didn't.
The real problem is that the test failed because you had a syntax error. You can already see that from the very first test.
$t->get_ok('/info/penx2')
->status_is(200)
This test also failed. (It's a bit confusing for people who are used to Test::WWW::Mechanize because there get_ok will also check if the response was 200 OK).
# Failed test '200 OK'
# at t/2410-topinfo.t line 12.
# got: '500'
# expected: '200'
The actual error message should be there without all that HTML markup somewhere else, because while it was doing the get_ok it would have encountered the error, which should have gone to the application log. In a unit-test, that probably is STDERR.
I don't know if you've not included it, or if it's omitted. The log should be there too I believe.
Getting back to the HTML and the actual question, the reason it's output is because Test::Mojo's content_like (and most other of its methods) uses Test::More under hood. It just dispatches to like from Test::More and passes along the page content. This in turn will always display the full string it was matching against.
In recent Test::More versions, it already uses Test2 under the hood. The relevant part that outputs the full string is here.
Unfortunately there is not much you can do about it. I'd focus on finding out why it doesn't show a proper log during the unit tests (possibly because you didn't run prove with -v), and maybe find a way to make errors come out in color, which would make it easier to read. There is a color logger for the Dancer2 framework (which I maintain), but I can't find one for Mojo there wasn't one for Mojo.
Now there is Mojo::Log::Colored, which can color individual log lines based on their log level.
use Mojo::Log::Colored;
# Log to STDERR
$app->log(
Mojo::Log::Colored->new(
# optionally set the colors
colors => {
debug => "bold bright_white",
info => "bold bright_blue",
warn => "bold green",
error => "bold yellow",
fatal => "bold yellow on_red",
}
)
);
This will give you nice colorful output to the console. Here's an example script.
$ MOJO_LOG_LEVEL=debug perl -Mojo -MMojo::Log::Colored \
-e 'a(
"/" => sub {
app->log->$_("hello world") for qw/debug info warn error fatal/;
shift->render(text=>"ok");
})->log( Mojo::Log::Colored->new )->start' \
daemon
And the output if called with $ curl localhost:3000.

Setting up PouchDB to Sync Gateway Walrus replication

I'm having a hard time setting up the replication between PouchDB and Sync Gateway.
I tried to follow Couchbase's blog post, but I wasn't successfull, either.
I'm building an Ionic application with angular-pouchdb and ng-pouchdb.
Here's what I got figured out so far:
every time I call pouchCollection it either creates a new database with the given name, or gives you a reference of the already created database;
the Sync Gateway is responsible for authorization of each document. I'm running it now with the GUEST user enabled, with "admin_channels": ["*"], so everyone should be able to access everything, right?
CORS should be enable, since both the app and the server are running on the same machine (localhost)
to get replication in both ways, I should use db.sync(URL) (angular-pouchdb), where URL is something like http://localhost:4984/prospect/ (and prospect could be the DB name)
Here's my Sync Gateway config.json file:
{
"log": ["CRUD", "REST+", "Access"],
"facebook": {"register": true},
"CORS": {
"Origin": ["http://localhost:8100"],
"LoginOrigin": ["http://localhost:8100"],
"Headers": ["Content-Type"],
"MaxAge": 17280000
},
"databases": {
"prospect": {
"server": "walrus:",
"users": {
"GUEST": {"disabled": false, "admin_channels": ["*"]}
},
"sync":
`
function(doc, oldDoc) {
channel("everything");
}
`
}
}
}
Here's my Ionic code:
app.controller('MyCtrl', function($scope, pouchCollection) {
$scope.students = pouchCollection('students');
var URL = 'http://localhost:4984/prospect/';
$scope.students.$db.replicate.sync(URL);
// ...list the array in the view
}
Whenever I try to make the replication work, I get the following in the console when running for the first time:
GET http://localhost:4984/prospect/_local/jeOaLtKGemQWDpNAPzorJQ%3D%3D?_nonce=1442271117949 404 (Not Found)xhRequest # pouchdb.js:641625.module.exports # pouchdb.js:6435ajax # pouchdb.js:604824.module.exports # pouchdb.js:6211ajax # pouchdb.js:989(anonymous function) # pouchdb.js:994ajaxPromise # pouchdb.js:993(anonymous function) # pouchdb.js:1241(anonymous function) # pouchdb.js:1069979 # pouchdb.js:10760(anonymous function) # pouchdb.js:7659(anonymous function) # pouchdb.js:764679 # pouchdb.js:1076068.Checkpointer.getCheckpoint # pouchdb.js:9407(anonymous function) # pouchdb.js:10076
pouchdb.js:6416 GET http://localhost:4984/prospect/_local/2_QcxPjLD.zmtOXa7VM8Gw%3D%3D?_nonce=1442271117953 404 (Not Found)xhRequest # pouchdb.js:641625.module.exports # pouchdb.js:6435ajax # pouchdb.js:604824.module.exports # pouchdb.js:6211ajax # pouchdb.js:989(anonymous function) # pouchdb.js:994ajaxPromise # pouchdb.js:993(anonymous function) # pouchdb.js:1241(anonymous function) # pouchdb.js:1069979 # pouchdb.js:10760(anonymous function) # pouchdb.js:7659(anonymous function) # pouchdb.js:764679 # pouchdb.js:10760(anonymous function) # pouchdb.js:9408
pouchdb.js:6416 GET http://localhost:4984/prospect/_local/jeOaLtKGemQWDpNAPzorJQ%3D%3D?_nonce=1442271118095 404 (Not Found)xhRequest # pouchdb.js:641625.module.exports # pouchdb.js:6435ajax # pouchdb.js:604824.module.exports # pouchdb.js:6211ajax # pouchdb.js:989(anonymous function) # pouchdb.js:994ajaxPromise # pouchdb.js:993(anonymous function) # pouchdb.js:1241(anonymous function) # pouchdb.js:1069979 # pouchdb.js:10760(anonymous function) # pouchdb.js:7659(anonymous function) # pouchdb.js:764679 # pouchdb.js:10760updateCheckpoint # pouchdb.js:930368.Checkpointer.updateTarget # pouchdb.js:936868.Checkpointer.writeCheckpoint # pouchdb.js:9362finishBatch # pouchdb.js:9829
(index):28 The above 404 is totally normal. PouchDB is just checking if a remote checkpoint exists.
Since the last line says it is normal, I assume everything is fine.
When I run the app in the browser and in the emulator, Sync Gateway says things like:
2015-09-14T19:54:04.913-03:00 HTTP: #001: GET /prospect/?_nonce=1442271244612
2015-09-14T19:54:18.730-03:00 HTTP: #002: GET /prospect/?_nonce=1442271258729
...
2015-09-14T19:56:13.362-03:00 HTTP: #049: GET /prospect/_local/2_QcxPjLD.zmtOXa7VM8Gw==?_nonce=1442271373356
2015-09-14T19:56:13.376-03:00 HTTP: #050: PUT /prospect/_local/2_QcxPjLD.zmtOXa7VM8Gw==
To me, it looks like everything is working. But I can't get it to sync with the iOS emulator or in a different browser.
What am I missing?
For your Questions..
[2]: The * Star channel is the channel where every document is automatically added to that channel. Example, a guest user will be granted the * star channel where that gives you the open ended access so any user that gets * (star) will be able to see everything in the system.
[3]: You do not need to enable CORS as sync gateway is running on the same domain as your webapp. Enabling CORS allows web apps to access resources on other domains rather than the origin domain.
The LoginOrigin list protects access to the _session and _facebook endpoints.
[4]: To replicate your data, within the app.js file you would define a URL variable for sync, like:
var SYNC_GATEWAY_URL = 'http://127.0.0.1:4984/prospect/';

strophe.js with http-bind failed to load resource 404 not found

I am trying to connect with ejabberd server using strophe.js, but I got the following error:
POST http://localhost/http-bind/ 404 (Not Found)
Strophe.Bosh._processRequest.sendFunc # strophe.js:4614
Strophe.Bosh._processRequest # strophe.js:4626
Strophe.Bosh._throttledRequestHandler # strophe.js:4778
Strophe.Bosh._connect # strophe.js:4177Strophe.Connection.connect # strophe.js:2335
$scope.login # app.js:162
fn # VM165:4
Ic.(anonymous function).compile.d.on.f # angular.js:23411
$get.n.$eval # angular.js:15916
$get.n.$apply # angular.js:16016
(anonymous function) # angular.js:23416
n.event.dispatch # jquery-2.1.3.min.js:3
n.event.add.r.handle # jquery-2.1.3.min.js:3
strophe.js:2784 7
I have found that Skype some time use port 80, that was assigned to Apache server.This think may prevent the http-binding.After quit Skype, It works fine.