RNEncryptedStorage is undefined in react-native-web - ios

I'm developing ios and web app. For storing credentials using encrypted storage, and in web I'm using local storage for now.
But at the time of compiling web app throws error.
rnw_blogpost.bundle.js:5540 Uncaught Error: RNEncryptedStorage is
undefined at eval (EncryptedStorage.js:1:862) at
Object../node_modules/react-native-encrypted-storage/lib/module/EncryptedStorage.js (rnw_blogpost.bundle.js:1766:1) at __webpack_require__
(rnw_blogpost.bundle.js:5537:33) at fn
(rnw_blogpost.bundle.js:5736:21) at eval (index.js:1:389) at
Object../node_modules/react-native-encrypted-storage/lib/module/index.js
(rnw_blogpost.bundle.js:1776:1) at __webpack_require__
(rnw_blogpost.bundle.js:5537:33) at fn
(rnw_blogpost.bundle.js:5736:21) at eval (encrypted-storage.ts:1:565)
at Object../src/util/encrypted-storage.ts
(rnw_blogpost.bundle.js:4098:1)
This is due to https://github.com/emeraldsanto/react-native-encrypted-storage/blob/master/src/EncryptedStorage.ts#L7
Is there any way, that in web I can handle it.

Looks to me like this might be a keychain permissions issue – the error in the source code doesn't show what is happening, but it looks like the system isn't able to import RNEncryptedStorage at all. Other possibility is that it may just be a missing dependency – have you tried pod install?

Related

How to install and load OAuth extension to avoid Uncaught Error message

I'm trying to set up OAuth to use between my website and Yahoo Fantasy Sports but getting the error message "Fatal error: Uncaught Error: Class 'OAuth' not found". I'm completely new to OAuth and the process described below is the first time I'm dabbling with this.
I've registered for a Yahoo API key and secret and am using them in this code in PHP to try to set up a basic test connection:
$o = new OAuth( $consumer_key, $consumer_secret,
OAUTH_SIG_METHOD_HMACSHA1,
OAUTH_AUTH_TYPE_URI );
Having searched here, I know I need an OAuth extension and PHPoAuthLib was recommended in another post. I've followed the instructions to install it on the web server via Composer (which basically seemed to be composer require lusitanian/oauth in SSH) but am still getting the "Uncaught Error" message. The php/ext folder on my server is empty and I'm don't know if that is a bad sign.
I've run a phpinfo() file on the server and it does not show oAuth. I've also read that I probably need to load the extension in a php.ini file on my server but I don't know exactly how I would do that for the PHPoAuthLib extension. I tried extension=oauth or extension=oauth.so but didn't seem to work.
Any help would be much appreciated! I'm not wedded to that particular extension (I've also seen a recommendation elsewhere for a Python Yahoo OAuth extension but I know nothing about Python or using 'pip')... I just feel like I'm going around in circles trying to figure out each step.
After trying both PHP and Python OAuth extensions mentioned above, it turned out my web hosting provider prevents custom installations via SSH on shared web hosting for security reasons, but was able to install the HTTP OAuth PEAR module that is available via cPanel to enable OAuth to be used.

Http2 Client in Angular 7

I want to use http2 for client side in my angular project.
I installed http2 with "npm install http2" command and I used sample client code in http2-npm.
However, I'm getting below warning
WARNING in ./node_modules/http2/lib/protocol/index.js 46:12-19
Critical dependency: require function is used in a way in which
dependencies cannot be statically extracted
With F12 on the page, Console error;
ERROR ReferenceError: process is not defined
at Object../node_modules/http2/lib/protocol/framer.js (framer.js:12)
at __webpack_require__ (bootstrap:79)
at Object../node_modules/http2/lib/protocol/endpoint.js (endpoint.js:3)
at __webpack_require__ (bootstrap:79)
at Object../node_modules/http2/lib/protocol/index.js (index.js:41)
at __webpack_require__ (bootstrap:79)
at Object../node_modules/http2/lib/http.js (http.js:136)
at __webpack_require__ (bootstrap:79)
at Object../node_modules/http2/lib/index.js (index.js:18)
at __webpack_require__ (bootstrap:79)
Thus, I cannot get data from server using http2 client. How can I fix these problem?
You don’t need a library for client side HTTP/2. The browser will automatically use HTTP/2 is the server supports it and use HTTP/1.1 I’d it doesn’t.
That’s one of the great things about the way HTTP/2 was implemented - it’s basically seamless to higher level applications like JavaScript.
Of course you might decide to tweak your app differently if HTTP/2 is being used (e.g. bundle less, or push) but those are mostly (and perhaps best) handled the on the server side.

How do I get polyfills to work with Relay?

I have a PHP app and I'm trying to use it with GraphQL and Relay, but trying to get Relay working I keep getting this error in my Browser (Chrome and Safari)
warning.js:36 Warning: Relay relies on polyfills for ES6 features in older browsers. Babel provides a good one: https://babeljs.io/docs/usage/polyfill/
I've tried all sorts of things, and I can't seem to get it to work.
Change webpack configuration, include the polyfill.js as a script.
I can't ignore that warning, because later on I will get:
RelayTaskQueue.js:97 Uncaught TypeError: _promise2.default is not a constructor
I managed to fix the problem myself. The problem was that I was running on Mac OS X with a case insensitive file system.
I tried creating a disk image with case sensitivity, and it worked. Followed instructions here. https://gist.github.com/dixson3/8360571 #

Push doesn't work (Error: Could not get)

Trying to use Ratchet's push.js, but doesn't work.
What I have in console:
[Error] Error: Could not get: file:///var/mobile/Applications/337585D8-89E1-4810-AB37-0A6DD2DA3A34/Gustav.app/www/booking.html
failure (ratchet.js, line 446)
onreadystatechange (ratchet.js, line 371)
If you will tap link like ten times you start to receive this:
[Error] TypeError: 'undefined' is not an object (evaluating 'cacheMapping[PUSH.id].url')
cachePush (ratchet.js, line 202)
PUSH (ratchet.js, line 392)
touchend (ratchet.js, line 258)
All this console data from real device tests (iOS 7.1), wrapper is Cordova CLI 3.4.1-0.1.0.
File booking.html exist, native safari failure like this
[Error] Failed to load resource: The requested URL was not found on this server. (menu.html, line 0)
doesn't appear.
push.js does not support file:// protocol.
Ratchet uses XHR requests to fetch additional pages inside the
application. Due to security concerns, modern browsers prevent XHR
requests when opening files locally (aka using the file:// protocol);
consequently, Ratchet does not work when opened directly as a file. A
common solution to this is to simply serve the files from a local
server. One convenient way to achieve this is to run python -m
SimpleHTTPServer to serve up the files in the current directory
to http://localhost:<port>
Also see this issue and this issue submitted on Github
It seems like this is a common issue with using Cordova and Ratchet.

DataCacheClients error, what might be the cause?

My team is using Moq as the testing framework. Since we need to test some http objects, sessions in particular, we explored some more options, and found a nice library called MVCContrib, which downloaded RhinoMocks while installing. When trying to call a method from MVCContrib, I get this error:
Test method
uBetPro.UI.Web.Tests.AccountController.AccountControllerTests.
.Login_CorrectCredentials_AuthenticationSuccess_ReturnsValidLicense
threw exception: System.Configuration.ConfigurationErrorsException:
Configuration system failed to initialize --->
System.Configuration.ConfigurationErrorsException: Unrecognized
configuration section
dataCacheClients.
(C:\Users\Shogun\AppData\Local\Temp\TestResults\Shogun 2013-06-27
15_23_17\Out\uBetPro.UI.Web.Tests.DLL.config line 27)
What might be causing this? I'd be glad if there's a way I can fix this, but my common sense implies that two different testing frameworks can't function in the same project, does that make sense?
It appears that you have an issue in your uBetPro.UI.Web.Tests.DLL.config at line 27
I would assume that you've got something you haven't mocked out correctly and it's trying to read from the config file
If it was a collision between mocking frameworks I would have expected to see compile time errors before you got as far as running tests

Resources