skygear-SDK-JS
skygear-SDK-JS copied to clipboard
Connecting to myapp.skygeario.com if endPoint in skygear.config is undefined
Consider this situation
// config.js
{
skygearHost: 'http://localhost:3000/'
}
// index.js
import skygear from 'skygear';
import config from './config';
skygear.config({
endPoint: config.skygearhost,
}).then(() => {
console.log('Success!'); // Success!
})
// some very deep file
import skygear from 'skygear';
skygear.lambda('mylambda').then(result => {}, error => {
console.log('error =', error);
})
What I am getting in console:
error = {
status: 404,
error: {
code: 117,
message: "route unmatched",
name: "UndefinedOperation"
}
}
And it surprises me a lot because my local skygear server is NOT running.
The cause of this is that I am having a typo during skygear.config(skygearhost
instead of skygearHost
).
So I am actually calling skygear.config({endPoint: undefined})
, which got accepted and used the default settings from the gulp script. I use the skygear
package from npm.
Excepted Behaviors
- Return a failure in skygear.config if required parameters are not supplied.
- Return failed promise in remote methods