Discover Meteor app not routing correctly - meteor

Router.route('/posts/:_id', {
name: 'postPage',
data: function() { return Posts.findOne(this.params._id); }
});
It's routing to the right path but not updating the template view
I deployed the app to
http://microscope-1.meteor.com/
and here's the link to that repository
https://github.com/sdybskiy/microscope-1.0

It's possible that Discover Meteor isn't updated for the newest version of iron:router. Try adding the previous version with meteor add iron:router#0.9.4.

Try doing this:
meteor remove iron:router
meteor add iron:router#1.0.0-pre4
Works for me!!!!

Related

Next js - AMP hybrid pages return 404

I'm building Next.js app, my main page is 'hybrid' amp page
export const config = { amp: 'hybrid' };
export default function Home({ data }) {...}
export async function getStaticProps() {
return {
props: { data: {...} },
revalidate: 6000,
};
}
I'm deploying to serverless using npx serverless
When deployed the /index.html home page has in its <head> the reference to the amp version of the page, which is /index.amp
<link rel="amphtml" href="/index.amp">
When I got to the amp page /index.amp I got 404 page
Any one know what's the problem please
"next": "11.0.0",
"react": "17.0.2",
"react-dom": "17.0.2",
Instead of directly accessing /index.amp, add ?amp=1 to the end of the URL you want to load the AMP version of the page.
Ref- https://nextjs.org/docs/api-reference/next/amp
Edit:
Ref- I am not aware of any AMP logic as of now, so it should be unsupported.
After lots of debugging, I found that AMP is not supported for the hybrid approach in serverless-next, although it working fine AMP-only configuration export const config = { amp: true }. That's the reason why it's working on localhost but not on deploy.
You can achieve this behaviour using nextjs server-side redirects.
It's not officially supported as of version #19.0.0.
My serverless.yml file
myApp:
component: '#sls-next/serverless-component#1.19.0'
Edit 2:
Finally it's working when I don't specify version.
My changed serverless.yml file
myApp:
component: '#sls-next/serverless-component'
My working deployed serverless amp version url is here
Note- If you do not specify the version, it will use the latest tag, which refers to the latest stable version here (i.e not alpha versions).

meteor keycloak third party

i want to test a keycloak request/response with a keycloak server in a docker file running on my localy machine.
The package Keycloak in atmospherejs doesnt work so i decided to include it to my meteor projekt as a third party library.
I put the library in a public/compatibility/keycloak/keycloak.js
The Autocomplete find it but if i use it then im getting a bug.
Exception while invoking method 'getTestToken' ReferenceError: Keycloak is not defined
But i do not understand it because it is correctly implemented as a thid party library in meteor. Can anybody help me to get this done?
Here I packaged the adapter library for meteor. Have not published it because I need to fork the original library and other stuff. Now you can call KeyCloak() on the client. Here's how I tested it in my router.js:
import { Keycloak } from 'meteor/mutdmour:keycloak'
Router.configure({
waitOn: [
function() {
console.log(Keycloak());
}
]
});
Here's what you can do to replicate what I did with other libraries:
create a package, now you can find it in your packages folder
meteor create --package mutdmour:keycloak
copied over the keycloak.js into packages/keycloak
changed the package.js file to reference the mainModule to run only on the client. This is why you are getting 'window is not defined'. Because it's running on the server. You could try putting that import in a if (Meteor.isClient()){...}
api.mainModule('keycloak.js', 'client');
added an export to package.js
api.export('Keycloak', 'client');
add the word export to the Keycloak definition in keycloak.js
export var Keycloak =
add the package
meteor add mutdmour:keycloak

JSX not being recognized by Meteor

I am getting started with meteor and react. This is what I have done:
meteor create simple-react
meteor add kadira:flow-router
meteor add kadira:react-layout
mkdir client server lib
mkdir client/components
touch client/head.html
touch lib/routes.jsx
In routes.jsx, I have added the home page route:
FlowRouter.route("/", {
name: "Home",
action(params) {
ReactLayout.render(Home);
}
});
In home.jsx, I have created a simple Home component.
In the browser console, I am getting an error: Unable to find "/".
If I convert the routes.jsx to route.js, then the routes work. But, I am getting the error: Not able to find the Home component in the browser log.
For some reason, the JSX is not being recognized by Meteor and not getting compiled to JS.
I have all the required packages - ecmascript, jsx, react, react-runtime.
Though I added kadira:react-layout, I had to explictly add react to the packages list. Adding react to the packages list fixed it.

Error when using iron:router with Meteor 0.9.3.1

I am experimenting with Meteor and iron:router. I git cloned the examples from https://github.com/EventedMind/iron-router.git. I then cd-ed into samples/basic, and ran meteor update and meteor. My meteor version is 0.9.3.1
When I navigated to the website an error is displayed in console and the page is empty. The error is as below:
Exception from Tracker recompute function: Error: Couldn't find a template named "/" or "". Are you sure you defined it?
at null._render (http://localhost:3000/packages/iron_dynamic-template.js?32038885cb1dad7957291ffebfffcb7f8cd57d20:239:17)
at doRender (http://localhost:3000/packages/blaze.js?7b7ff7ee2ccdccd85a1ad0d8dc9d96193e29e8b0:1853:25)
at http://localhost:3000/packages/blaze.js?7b7ff7ee2ccdccd85a1ad0d8dc9d96193e29e8b0:1795:16
at Object.Blaze._withCurrentView (http://localhost:3000/packages/blaze.js?7b7ff7ee2ccdccd85a1ad0d8dc9d96193e29e8b0:2029:12)
at viewAutorun (http://localhost:3000/packages/blaze.js?7b7ff7ee2ccdccd85a1ad0d8dc9d96193e29e8b0:1794:18)
at Tracker.Computation._compute (http://localhost:3000/packages/tracker.js?192a05cc46b867dadbe8bf90dd961f6f8fd1574f:288:36)
at new Tracker.Computation (http://localhost:3000/packages/tracker.js?192a05cc46b867dadbe8bf90dd961f6f8fd1574f:206:10)
at Object.Tracker.autorun (http://localhost:3000/packages/tracker.js?192a05cc46b867dadbe8bf90dd961f6f8fd1574f:476:11)
at Blaze.View.autorun (http://localhost:3000/packages/blaze.js?7b7ff7ee2ccdccd85a1ad0d8dc9d96193e29e8b0:1793:19)
at http://localhost:3000/packages/blaze.js?7b7ff7ee2ccdccd85a1ad0d8dc9d96193e29e8b0:1847:10 debug.js:41
Can someone kindly advise what I am doing incorrectly?
Thanks in advance.
The reason you have this issue is there is a discrepancy between the iron-router#1.0.0-pre-x (like a Beta for 1.0) and the currently in use 0.9.x version of iron router.
The old notation for defining a route for http://localhost:3000/route, for the template route would be as follows:
Router.route("route", { path : '/' });
However in the new version, which is currently on github on devel (which I presume the examples are based on is as follows):
Router.route("/", function() {
this.render("route");
});
The problem is using the notation on the bottom would lead to the error Couldn't find a template named "/" since the first param of the Route.route is now a path instead of a template.
The way to fix this is to either use the pre-release version of iron router (the version string can be found in the package.js file on github):
meteor remove iron:router
meteor add iron:router#1.0.0-pre3
Or to use the old notation by looking at an example bundled with a release on github instead of the devel branch like this one: https://github.com/EventedMind/iron-router/tree/v0.9.2-rc0

Meteor 0.8.0, Iron Router and Discover Meteor

Meteor 0.8.0 is out with the new Blaze rendering, which is great... for the future.
At the present I can't run my Iron Router powered app: updated -> ran meteor -> white browser screen. I guess I'll roll back to 0.7.2. but that gives me a fuzzy feeling. Its like have a new computer with no internet connection. Is there any fix for these changes? At least for Iron Router?
Note Comment (although it was in the title):
I am learning meteor using the Discover Meteor book, it's a great book written by same author of Iron Router; I love it. However, if meteor changed that much am I wasting my time?
Update
#iAmME's solution works great! I solved it another way that also fixed iron-router-progress by modifying the smartpackage. Just wanted to post it if it helps anyone:
{
"packages": {
"blaze-layout": {},
"iron-router":
{
"git": "https://github.com/EventedMind/iron-router.git",
"branch": "blaze-integration"
},
"iron-router-progress":
{
"git": "https://github.com/Multiply/iron-router-progress.git",
"branch": "blaze-integration"
}
}
}
Just faced the same issue,
Did the following and works fine
It occurs mostly because of the iron-router package and few other packages which are using spark as dependency and first re-install the iron-router like below
meteor remove iron-router
rm -rf packages/iron-router
mrt update
mrt add iron-router
Just re-installing the iron-router will update you to the new version and also it installs blaze-Layout automatically with the iron-router(which is the new templating system).
After updating iron-router,Even now if you are getting spark is not defined error,check which package is using spark and update those packages too.
You have to update your iron-router package. Check out the Iron Router github page https://github.com/EventedMind/iron-router for information on what's new in their 0.7.0 release. It works for Meteor 0.8.0.

Resources