Session is not Defined Using OpenShift for a Meteor Application - javascript

I am trying to use OpenShift for my Meteor application which uses session variables. The application loads fully, but once the user begins interacting with it, the site fails to load anything because "ReferenceError: Session is not defined." This is really weird because the application runs flawlessly on localhost. Anyone know why this could occur?

You need to add the 'Session' package with 'meteor add session'. I've had the same error in the past when I forgot to add the package.

Related

typeEror - o.map is not a function shows in react from hosted

I am making a MERN e-commerce project with redux.
I have hosted my backend in Heroku and my frontend is hosted in vercel .
everything running fine from localhost but when I open hosted site
then it shows "o.map is not a function" on console
Here is my project github link-
Frontend- https://github.com/arijitdas13105/Ashop-frontend-new
Backend- https://github.com/arijitdas13105/ashop-backend
My hosted website link - https://ashop-frontend-99x2ayoh7-arijitdas13105.vercel.app/products
My backend Product API - https://ashop-server.herokuapp.com/api/products
let me know anything else need.
When you host in vercel, your JS code is minified with react-scripts build (You can see it in your package.json). This o.map is other variable in your code, probably the products.map. You can solve this issue using products?.map instead, so it will try to render the elements only when it has content.
If the data is not load and you don't know why, I recommend you to run it with npm run dev and figure out the reason (you can use debugger or console.log).
You can see the Network Tab in your devtools to see what the backend is returning as well.

Weird CORS errors on fresh vue cli project

I just started building my second Vue project, and for the first time I wanted to use the Vue CLI and NPM rather than just loading Vue via CDN.
Installing the CLI and setting up the project worked without problems, but when I ran "npm run serve" and navigated to localhost:8080 in my browser (latest Firefox) to see if it worked, I got the following error message in my browser console multiple times:
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://10.126.86.51:8080/sockjs-node/info?t=1584021154635. (Reason: CORS request did not succeed).
I also get this error message once right after loading the page:
[WDS] Disconnected!
Does anyone know what these errors mean, why I get them and how I can get rid of them?
The first one seems to be related to some kind of cross-origin call that the app is making using the host's actual IP rather than localhost, but I can't think of any reason why it would, given that I literally just installed and served the example project and did not change anything after running "vue create"
Edit: I am on Ubuntu 19.10 Desktop
First of all, what kind of OS you are working on? If you are working on unix based systems, a service (like nginx) could produce this error. If so, try stopping it.
Afterwards I would try to run your application from vue ui.
Type in your terminal:
vue ui
This starts the web based graphical user interface of vue cli. You can handle your app development from there by starting your service and run your build command.
ATTENTION: you must add (import, NOT create) your project (root folder) to the UI.
If you get the same error inside your browser console, set up a vagrant box. First steps are explained here:
https://www.vagrantup.com/intro/getting-started/
Follow instructions for project setup.
Simplest way would be running
vagrant init
inside your project folder. Therefore you don't have to setup a new project.
After running the init command, try running
npm run serve
or use vue UI instead (as explained above), if you prefer it.
If the problem still exists, more infos about your OS would be helpful.

Error: GET http://localhost:4200/assets/vendor.js net::ERR_INVALID_CHUNKED_ENCODING, on Ember.js server

I am just getting started with Ember.js at v2.9.0, followed the tutorial on their page https://guides.emberjs.com/v2.9.0/tutorial/ember-cli/, all good, save for one detail: Whenever I tried to refresh or load the development web app on Chrome browser after executing ember server on the cmd, the app would not load in browser and provide the following error most of the time (there were other errors as well but seem to be related to this one):
GET http://localhost:4200/assets/vendor.js net::ERR_INVALID_CHUNKED_ENCODING
, and one of the related errors is:
Uncaught ReferenceError: define is not defined
at application.js:1
I have searched for this specific error but without luck, I tried some fix hints found, such as clearing some persistent data with the netsh command, doing an npm cache clean bower cache clean, deleting the node_modules and the bower_components folders and reinstalling dependencies; also ensuring that there was no weird proxy configuration in my LAN settings, etc.
I have encountered this error while following the tutorial, and it would kind of be bypassed by refreshing the browser a few times until the app displayed. That was before, but now the refresh does not work when working on an existing application.
I am on:
Windows 10
ember-cli v.2.9.1
node.js LTS v.6.9.1
I need to get going with this rather soon, so any hint to resolve this issue is appreaciated. Thanks!
Might be a conflicting process running... Are you working over a VPN? If so, take a look at https://superuser.com/questions/893908/err-invalid-chunked-encoding-from-chrome

Meteor app suddenly no longer runs on iOS

My Meteor-based app no longer works as designed on iOS, without me having changed anything relevant. The app still works when run from a local server (http://localhost:3000) as well as when hosted at meteor.com. But, in an iOS simulator and when deployed to an iOS device through xCode, the app fails to run properly.
The app opens with a form that needs to be filled in by the user. When submitting the form, on iOS, the entered values briefly are stored in session variables, but almost immediately the session variables are emptied and the form is displayed again. (What should happen is for an external JSON file to be loaded, based on the form values, after which the contents of that JSON file is manipulated and displayed.)
I just now upgraded to the latest version of Meteor, and xCode did an upgrade itself in the background.
The app is supposed to load a Google font file (from fonts.googleapis.com), but though this works fine when the app is served from either the localhost or meteor, the font does not appear to be loaded when the app runs on iOS.
I'm sorry I don't have actual example code (the whole app?) or a running version of the app that I can show you. As the app is not yet publicly available, I'm a bit reluctant to publish it here. :(
Is there a way to meaningfully debug a Meteor app running on iOS? Is there something obvious I'm missing in the deployment?
Turns out there's an issue with meteor 1.0.4 and building a project using Cordova (https://github.com/meteor/meteor/issues/3814).
I downgraded to meteor 1.0.3 through:
meteor update --release 1.0.3
Then, I deleted the Cordova folder in .meteor/local/ with
rm -R cordova-build
Then, I patched 1.0.3 to 1.0.3.2 with
meteor update --patch
This solved the problem.

Javascript error in rails app (locally run)

I am trying to move a development environment from production to my local machine (Ubuntu), and when I get the code up and running on my box, the site works in rails but I get this JS error:
Permission denied for http://ad.doubleclick.net to call method Location.toString on http://localhost:3000.
Line 0
Do you have any idea how to fix JS problems, or should I disable the ads in development?
This is most likely an error that you can ignore. Its probably contained to an iframe created by the advertisement module.
I'm pretty sure that error occurs on the production version too, unless the production version is actually hosted at ad.doubleclick.net, which I guess its not :)

Categories