Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Referencing the wrong server or not being able to load remote content from rcredits.org #28

Open
TheOtherRealm opened this issue May 5, 2016 · 19 comments

Comments

@TheOtherRealm
Copy link

Hello Sassafras – this is Aaron, a new developer with rCredits. I have been trying to build your new mobile app but have been running into error messages. Initially my errors had to do with my not fully understanding Ionic, however after resolving those, I now think it is more the rCredits app, related to referencing the wrong server or not being able to load remote content from rcredits.org. I am getting errors after scanning in a barcode. In Android Studio/Android Manager/logcat, it now gives the message:

...
05-05 14:08:30.671 12503-12512/com.ionicframework.rcreditsmobile621273 D/dalvikvm: GC_FOR_ALLOC freed 0K, 17% free 11604K/13816K, paused 20ms, total 20ms
05-05 14:08:30.702 12503-12503/com.ionicframework.rcreditsmobile621273 D/CaptureActivityHandler: Got decode succeeded message

                                                                                                 [ 05-05 14:08:30.999 26009:14745 D/         ]
                                                                                                 PPM: Focus finished in:  :738.404 ms :  1462471711004 ms
05-05 14:08:32.350 12503-12503/com.ionicframework.rcreditsmobile621273 D/CaptureActivityHandler: Got return scan result message
05-05 14:08:33.054 12503-12503/com.ionicframework.rcreditsmobile621273 D/CordovaInterfaceImpl: Sending activity result to plugin
05-05 14:08:33.616 12503-13383/com.ionicframework.rcreditsmobile621273 D/dalvikvm: GC_FOR_ALLOC freed 2117K, 25% free 10424K/13816K, paused 78ms, total 80ms
05-05 14:08:34.179 12503-12503/com.ionicframework.rcreditsmobile621273 I/chromium: [INFO:CONSOLE(0)] "XMLHttpRequest cannot load https://stage-new.rcredits.org/pos. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://192.168.2.2:8100' is therefore not allowed access.", source: http://192.168.2.2:8100/#/app/login (0)
05-05 14:08:34.186 12503-12503/com.ionicframework.rcreditsmobile621273 I/chromium: [INFO:CONSOLE(28)] "", source: http://192.168.2.2:8100/ (28)
05-05 14:08:34.194 12503-12503/com.ionicframework.rcreditsmobile621273 I/chromium: [INFO:CONSOLE(28)] "Translation for undefined doesn't exist", source: http://192.168.2.2:8100/ (28)
05-05 14:08:34.202 12503-12503/com.ionicframework.rcreditsmobile621273 I/chromium: [INFO:CONSOLE(28)] "Translation for  doesn't exist", source: http://192.168.2.2:8100/ (28)
05-05 14:08:34.233 12503-12503/com.ionicframework.rcreditsmobile621273 I/chromium: [INFO:CONSOLE(28)] "Translation for undefined doesn't exist", source: http://192.168.2.2:8100/ (28)
05-05 14:08:34.233 12503-12503/com.ionicframework.rcreditsmobile621273 I/chromium: [INFO:CONSOLE(28)] "Translation for  doesn't exist", source: http://192.168.2.2:8100/ (28)

And in the console:

1     649155   error    Unable to load user from Storage
2     652928   error    No offline transactions
3     652931   error    No offline transactions
0     697866   error    Unable to load user from Storage
1     702430   error    No offline transactions
2     702436   error    No offline transactions
3     714186   error
4     714199   warn     Translation for undefined doesn't exist
5     714204   warn     Translation for  doesn't exist
6     714233   warn     Translation for undefined doesn't exist
7     714234   warn     Translation for  doesn't exist

Do you have any idea why I am getting these? I am assuming it must have something to do with a configuration somewhere but where, I am not sure.

@jpdimond
Copy link
Collaborator

jpdimond commented May 5, 2016

Hi there, looks like you are running into cross origin issues which is a problem with your development environment. You can read more about that here:
https://jvaneyck.wordpress.com/2014/01/07/cross-domain-requests-in-javascript/

@TheOtherRealm
Copy link
Author

TheOtherRealm commented May 5, 2016

Alright, that makes sense. I haven't changed the code any other then the steps outlined in the GitHub readme. It obviously is trying to call my local machine (http://localhost:8100/pos in config.js?) and reference rCredits, however this configuration is what I got from the server. It probably should be something else – but what, I guess is my question.

@jpdimond
Copy link
Collaborator

jpdimond commented May 5, 2016

Could you give me some more details in how you are running the app? Are you running it on a device or emulator?

@TheOtherRealm
Copy link
Author

I'm running it on my physical device
On May 5, 2016 3:58 PM, "Jill Dimond" notifications@github.com wrote:

Could you give me some more details in how you are running the app? Are
you running it on a device or emulator?


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#28 (comment)

@TheOtherRealm
Copy link
Author

I'm running an unlocked version of Samsung Galaxy, Google flavor Android 4.3
On May 5, 2016 4:27 PM, "Aaron E-J" azintirea@gmail.com wrote:

I'm running it on my physical device
On May 5, 2016 3:58 PM, "Jill Dimond" notifications@github.com wrote:

Could you give me some more details in how you are running the app? Are
you running it on a device or emulator?


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#28 (comment)

@jpdimond
Copy link
Collaborator

jpdimond commented May 5, 2016

Got it, just making sure you weren't running it on an emulator. Two things:

  1. Are you running what's in the develop branch?
  2. Could you paste what you have for www/js/config.js?

@TheOtherRealm
Copy link
Author

TheOtherRealm commented May 6, 2016

Yes, I am running in the developer branch
I haven't changed anything that is not on GitHub, I don't think, but
here it is, I've embolden the version I'm using:

// Most app config should go here. Use the BUILD_TARGET directives below to set config that depends on
// whether the app is in dev mode, staging mode, etc.
rCreditsConfig = {
  SQLiteDatabase: {
    name: 'rcredits',
    version: '1.0',
    description: 'rCredits DB',
    estimatedSize: 20 * 1024 * 1024 // kb
  },
// For Demo Cards
  stagingServerUrl: 'https://stage-xxx.rcredits.org/pos',
  // @if BUILD_TARGET='development'
  serverproxyUrl: 'http://localhost:8100/pos',
  serverUrl: 'https://stage-xxx.rcredits.org/pos',
  version: '3.0',
  build: 300,
  transaction_max_amount_offline: 300
  // @endif
  // @if BUILD_TARGET='staging'
  serverproxyUrl: 'http://localhost:8100/pos',
  serverUrl: 'https://stage-xxx.rcredits.org/pos',
  version: '3.0',
  build: 300,
  transaction_max_amount_offline: 300
  // @endif
  // @if BUILD_TARGET='production'
  serverproxyUrl: 'http://localhost:8100/pos',
  serverUrl: 'https://xxx.rcredits.org/pos',
  version: '3.0',
  build: 300,
  transaction_max_amount_offline: 300
  // @endif
};

@smoyte
Copy link
Contributor

smoyte commented May 6, 2016

Perhaps try running the app in your browser first with ionic serve. That
should be easier to debug. Check your JS console for any errors. I suspect
you might be missing the plugin that handles the content origin policy.

On Thu, May 5, 2016 at 8:04 PM, Aaron E-J notifications@github.com wrote:

Yes, I am running in the developer branch
I haven't changed anything that is not on GitHub, I don't think, but
here it is, I've embolden the version I'm using:

// Most app config should go here. Use the BUILD_TARGET directives below
to set config that depends on
// whether the app is in dev mode, staging mode, etc.
rCreditsConfig = {
SQLiteDatabase: {
name: 'rcredits',
version: '1.0',
description: 'rCredits DB',
estimatedSize: 20 * 1024 * 1024 // kb
},
// For Demo Cards
stagingServerUrl: 'https://stage-xxx.rcredits.org/pos',
// @if BUILD_TARGET='development'
serverproxyUrl: 'http://localhost:8100/pos',
serverUrl: 'https://stage-xxx.rcredits.org/pos',
version: '3.0',
build: 300,
transaction_max_amount_offline: 300
// @endif
// @if BUILD_TARGET='staging'
serverproxyUrl: 'http://localhost:8100/pos',
serverUrl: 'https://stage-xxx.rcredits.org/pos',
version: '3.0',
build: 300,
transaction_max_amount_offline: 300
// @endif
// @if BUILD_TARGET='production'
serverproxyUrl: 'http://localhost:8100/pos',
serverUrl: 'https://xxx.rcredits.org/pos',
version: '3.0',
build: 300,
transaction_max_amount_offline: 300
// @endif
};

Aaron E-J
http://otherrealm.org
Vision without action is a daydream,
Action without vision is a nightmare,
One needs both to succeed.
On 2016-05-05 4:49 PM, Jill Dimond
wrote:

Got it, just making sure you weren't running it on an emulator.
Two things:

  1. Are you running what's in the develop branch?
  2. Could you paste what you have for www/js/config.js?

    You are receiving this because you authored the thread.

Reply to this email directly or view
it on GitHub


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub
#28 (comment)

Tom Smyth

Worker-Owner, Sassafras Tech Collective
Specializing in innovative, usable tech for social change
sassafras.coop · @sassafrastech

Resident, Touchstone Cohousing
touchstonecohousing.org

@smoyte
Copy link
Contributor

smoyte commented May 6, 2016

@TheOtherRealm
Copy link
Author

There I don't even get to the scan screen.

@TheOtherRealm
Copy link
Author

Even using the following, I am still getting it:

  <allow-navigation href="https://*"/>
  <allow-navigation href="http://*"/>
  <allow-intent href="http://*/*"/>
  <allow-intent href="https://*/*"/>

@TheOtherRealm
Copy link
Author

Wait, didn't install the pluggin... :-)

@TheOtherRealm
Copy link
Author

Nope, realized it was already installed and still nothing...

@smoyte
Copy link
Contributor

smoyte commented May 6, 2016

Anything in your console?

On Thu, May 5, 2016 at 8:59 PM, Aaron E-J notifications@github.com wrote:

Nope, realized it was already installed and still nothing...


You are receiving this because you commented.
Reply to this email directly or view it on GitHub
#28 (comment)

Tom Smyth

Worker-Owner, Sassafras Tech Collective
Specializing in innovative, usable tech for social change
sassafras.coop · @sassafrastech

Resident, Touchstone Cohousing
touchstonecohousing.org

@TheOtherRealm
Copy link
Author

Same thing as before.

@jpdimond
Copy link
Collaborator

jpdimond commented May 6, 2016

Ok, I'm going to create a new project and see if I can recreate the problem.

@TheOtherRealm
Copy link
Author

TheOtherRealm commented May 6, 2016

I think it may be due to the fact that it is referencing the wrong address. I turned off wireless and my phone's ip is now 10.95.155.254 but I'm getting the message:
Server refused the connection. (http://192.168.2.2:8100)`
This is my laptops IP.

@jpdimond
Copy link
Collaborator

jpdimond commented May 6, 2016

So Android Whitelist plugin should be taking care of this. I have pushed a new config.json file with versions of the plugins. I would recommend doing a fresh install, but I need to update the readme with a couple things.

@jpdimond
Copy link
Collaborator

jpdimond commented May 6, 2016

Ok, updated the readme. I did a fresh install and it worked just fine. Let me know how it goes!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants