I have my axios calls data printed in the terminal - firebase

I don't know how to explain it better: I'm using Visual Studio Code, Nuxt and Axios, and whenever I refresh my app in the browser I get all the content of my axios call printed in the vsc terminal.
I think I may have made some changes in the google inspector but I'm not sure.

Nothing strange here, Nuxt is running on both client side and server side. Here, you have a console.log probably called in a context when both are available.
On top of that, the initial request is always coming from the server hence why you can see it in your terminal.
Similar to a Node.js app, the output of your console.log is on the "backend" aka you terminal here.

Related

How to troubleshoot failed API calls to .NET project running over localhost?

I have an API in a .NET project that I'm running with Visual Studio Mac (8.4.3). I run it in release mode, and it opens a browser window with localhost:5000. The browser window says "ok". However, when I try to hit endpoints in that API, it fails very quickly. When I ran this API (ie. same code) from another server and accessed it via proxy, it ran fine. For example, when I ran it on a server whose IP was 162.250.198.98 and proxied into it, I would hit an endpoint like 162.250.198.98:3000/api/user and it would work, but now when I try to run localhost:5000/api/user, either from my app or from Postman, it fails almost instantaneously. When running it in Postman, I tried what it suggested by turning off 'SSL certificate verification' in Settings, but no change.
Can anyone advise me on how to approach troubleshooting this?
Wait, so You are saying that while trying to call API on 162.250.198.98:3000/api/user You are fine but while trying to do the same thing on localhost:5000/api/user You are getting an error? Would it might be possible You have Your API configured to receive calls at 3000? :)?
No, but really - please chech it out, maybe it is that simple, I'm couting on it :).
You can change/check it in Visual Studio: main project > Properties > Debug > App URL.

Google App maker debugging

Does App maker has any debugging options on the JavaScript functions. I can see debugging options in google script.
When I tried to run functions it shows the error in the logger, it is not enough to identify the exact issue. If there is a default debugging option it will be easy to identify the issue
There are different debugging techniques for App Maker and they are different for Server and Client scripts.
Client Script debugging:
Write 'debugger;' statement in code where you need to break, redeploy app, open Browser Dev Tools and reload app. It is just a basic JS debugging technique.
You can use 'console.log()' to put some messages to browser's console.
Server Script debugging:
You can use 'console.log()' to put some messages to browser's console (this will work only if you are deployment owner, otherwise you'll not see these messages).
You can use 'console.log()' and see your messages in Google Cloud Platform logs for your Deployment:
or Preview:

gapi.auth2.ExternallyVisibleError: Invalid cookiePolicy

I'm trying to add a Google Sign In Authentication system to my app, but I keep getting a strange error that I haven't seen anyone get. I'm using EXACTLY the google example code.
I thought it could be some mistake when loading the api, so I checked the async loading and everything seems to be loading properly, but I keep getting this error in the console:
gapi.auth2.ExternallyVisibleError: Invalid cookiePolicy
I searched everywhere for people with the same problem, but I could not find anything similar.
Any ideas?
EDIT: I tried to create a page with ONLY the code of the tutorial, but the error still occurs.
Well, turns out I was trying to test the API by directly acessing my files locally (index.html). The Google Sign In API only works in a running web server. I started a simple node.js server, ran my app trhough this server, and everthing worked just fine.
As already answered by KoJoVe, you need to run inside a web server. If you are using Python 2.7 you might use python -m SimpleHTTPServer 8000 and then use localhost:8000 on your browser
I've been trying to get a chrome extension to work for a very long time, and I recently decided to click into the error. The reason is because the google platform script checks window.location.protocol (which isn't https for chrome extension) and throws the error 'invalid cookie policy'.
My theory as to why Google won't fix this:
They want to drive people into using paid OAuth2 endpoints
They want to know who received the tokens, if possible (via certificate authorities)
I was having this problem using react-google-login in a create-react-app, and I found that I was accessing the page with http://[::1]:3000/sign_in instead of localhost.
I think google does not like 127.0.0.1 or ::1 since we expose the IP directly or something
When I change to localhost:3000 and it worked.
This worked in my case with python 3:
open python terminal and write the following code:
from http.server import SimpleHTTPRequestHandler as handler
import socketserver as socket
httpd = socket.TCPServer(("",8000),handler)
httpd.serve_forever()

Meteor android build version

I have a strange issue. I build my Meteor app and run it on android device using -
meteor run android-device --mobile-server=<my_aws_ip>:3000
When the app deploys immediately it connects to the server (and my javascripts etc works). After a few seconds, the page refreshs and none of the javascript callbacks work. Please help me debug this issue.
More information: If I change the client (and not the server), and deploy it, for the first few seconds, the changed client gets shown on the phone. After the first few seconds, the version which is present on the server is shown. So I think Cordova or Meteor is trying to fetch the client code from the server, which is breaking the app. Is there a way to prevent this behavior?
Even more data points -
My aws code does NOT have android and ios platforms installed. Because of this, I think the cordova plugins are not installed, causing a JS break somewhere.
Easiest fix I can think of is remove cordova autoupdate. This is being added by meteor-platform package. If I clone meteor-platform and comment out the cordova autoupdate, the app doesn't load.
Is there another way of removing autoupdate?
This sounds like you have a different version of your app deployed at the mobile-server address.
The local code is run in development mode. Your AWS one is likely in production mode (and may contain a syntax error).
When you run your app it sees the code is different and fetches the new/old (different) version with a hot code reload - hence the page refresh/flash.
To fix this, you need to find the syntax error in your code. It's best to view the ADB logger or run with meteor run --verbose android-device ....
This will provide a bit more information such as an Uncaught exception: cannot read .. of null error type error.
It's hard to say what the error is. The error prevents the rest of your code from executing. In production mode the entire project is one JS file. If there is an error of any kind half way along the file, the rest of the file will not execute.
Also, try loading <my_aws_ip>:3000 in your browser and watch for JS errors in the JS console.
You can also run it locally with --production to simulate a production build environment locally.
Enabling autoupdate but without a page refresh:
Reload._reload = function (options) {
console.log("Next load will load new version");
};

How to use console.log in meteor jasmine tests

I'm using
Meteor 1.0.2.1
sanjo:jasmine 0.9.1
velocity:html-reporter 0.3.2
https://doctorllama.wordpress.com/2014/09/22/bullet-proof-internationalised-meteor-applications-with-velocity-unit-testing-integration-testing-and-jasmine/ says I should be able to use console.log() to see output in the console.
But nothing happens for me.
If I move the call out of tests/jasmine into client/ or server/ then the output is on the terminal where meteor is run.
The html-reporter also has a section called Logs. Looking at the code it appears to have a reactive collection on VelocityLogs. My google-fu is failing me as I can find no information on how to get any output to display in this section.
What is the correct way of logging in jasmine tests?
In Chrome the client side logs are visible through the JavaScript Console.
But I still don't know where the server side logs might be.
I've run with DEBUG=1 JASMINE_DEBUG=1 VELOCITY_DEBUG=1 VELOCITY_DEBUG_MIRROR=1 and the console logs do not appear either.
Edit:
I've created a repo to provide an example of the problems at https://github.com/baerrach/meteor-velocity-issue-223.
If you are running server integration tests and they're not appearing, you may have found a bug!
Try running with:
VELOCITY_DEBUG=1 meteor
The logs should appear in the same place as the main meteor logs appear, prefixed with [velocity-mirror]

Resources