ReferenceError: Uncaught error: regeneratorRuntime is not defined #1
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Hello, When I try to access one of the endpoints created by the plugin, i get the following error 'ReferenceError: Uncaught error: regeneratorRuntime is not defined'. I suppose it is related to babel. Do I need to add any extra configuration to babel on my app to make the plugin work as it should?
Hey,
I had forgotten to require
babel/polyfill
if it's not already required. I just published an update with the fix.hapi-sequelize-crud@2.0.9
Ok! Thanks! It is working. Another question i would like to ask you is how the one-to-one and one-to-many relations should be defined in order for the crud to work because i'm having a problem with using the POST method for that:
let's say i have the following relations:
team.hasMany(players) player.belongsTo(team)
when i try to create a player with the POST '/team/{teamId}/player' i get the following error:
method is not a function at handler$ (.../hapi-sequelize-test/node_modules/hapi-sequelize-crud3/build/associations/one-to-one.js:120:45)
from what i could gather after looking at the code is that the problem comes from the getMethod() function from the utils.js because it is trying to get the method 'createplayer' from the model that is passed to the function which is the team model.
Is this related to the way you should define the relations? or are you creating these create functions when defining the relations?
@FoxMcCloudDX
The methods should work fine if you define relations correctly.
See this file as an example of how I've defined my relations:
https://github.com/mdibaiee/teamline/blob/master/src/relations.js
I'm not really sure about your case, but it should work fine if you use
Team.hasMany(Player)
andPlayer.belongsTo(Team)
.Hello again! I noticed that on your latest fix to this issue you added require('babel/polyfill') instead of 'babel-polyfill' and neither one is a dependency for your project. is there a reason why you are usin the '/' instead of '-'? and would it be best to add the babel-polyfill to your package.json?
@FoxMcCloudDX Hey! that's because we use babel@5, the reason being decorators. Decorators are disabled, pending proposal update in babel@6, and
babel/polyfill
is the way to go when using babel@5.Ah, you're right, I had to add
babel
it to dependencies, and I just did (hapi-sequelize-crud@2.0.10
). Thanks for noting!