I am trying to connect to a SQL Server database from within my sails.js app. I'm using sergeibelov/sails-mssql to connect to a remote Azure instance.
I've set up the database info in config/adapters.js.
When I try to connect using valid credentials, I get the following error:
error: Hook failed to load: orm (Error: Incorrect syntax near the keyword 'user'.)
error: Error encountered while loading Sails core!
error: Error: Incorrect syntax near the keyword 'user'.
at Request.userCallback (TestApp/node_modules/sails-mssql/node_modules/mssql/lib/tedious.js:352:23)
at Request.callback (TestApp/node_modules/sails-mssql/node_modules/mssql/node_modules/tedious/lib/request.js:24:27)
at Connection.STATE.SENT_CLIENT_REQUEST.events.message (TestApp/node_modules/sails-mssql/node_modules/mssql/node_modules/tedious/lib/connection.js:198:29)
at Connection.dispatchEvent (TestApp/node_modules/sails-mssql/node_modules/mssql/node_modules/tedious/lib/connection.js:465:59)
at Connection.c.dispatchEvent (TestApp/node_modules/sails-mssql/node_modules/mssql/lib/tedious.js:206:26)
at MessageIO. (TestApp/node_modules/sails-mssql/node_modules/mssql/node_modules/tedious/lib/connection.js:419:20)
at MessageIO.EventEmitter.emit (events.js:92:17)
at MessageIO.eventData (TestApp/node_modules/sails-mssql/node_modules/mssql/node_modules/tedious/lib/message-io.js:59:21)
at Socket. (TestApp/node_modules/sails-mssql/node_modules/mssql/node_modules/tedious/lib/message-io.js:3:59)
at Socket.EventEmitter.emit (events.js:95:17)
at Socket. (_stream_readable.js:746:14)
at Socket.EventEmitter.emit (events.js:92:17)
at emitReadable_ (_stream_readable.js:408:10)
at emitReadable (_stream_readable.js:404:5)
at readableAddChunk (_stream_readable.js:165:9)
at Socket.Readable.push (_stream_readable.js:127:10)
at TCP.onread (net.js:526:21)
When I change to an invalid user, I get a different error:
error: Hook failed to load: orm (Error: Login failed; one or more errorMessage events should have been emitted)
error: Error encountered while loading Sails core!
error: Error: Login failed; one or more errorMessage events should have been emitted
at TestApp/node_modules/sails-mssql/node_modules/mssql/lib/tedious.js:238:19
at TestApp/node_modules/sails-mssql/node_modules/mssql/node_modules/generic-pool/lib/generic-pool.js:271:11
at Connection.connect (TestApp/node_modules/sails-mssql/node_modules/mssql/lib/tedious.js:215:24)
at Connection.g (events.js:180:16)
at Connection.EventEmitter.emit (events.js:95:17)
at Connection.processLogin7Response (TestApp/node_modules/sails-mssql/node_modules/mssql/node_modules/tedious/lib/connection.js:592:12)
at Connection.STATE.SENT_LOGIN7_WITH_STANDARD_LOGIN.events.message (TestApp/node_modules/sails-mssql/node_modules/mssql/node_modules/tedious/lib/connection.js:153:23)
at Connection.dispatchEvent (TestApp/node_modules/sails-mssql/node_modules/mssql/node_modules/tedious/lib/connection.js:465:59)
at Connection.c.dispatchEvent (TestApp/node_modules/sails-mssql/node_modules/mssql/lib/tedious.js:206:26)
at MessageIO. (TestApp/node_modules/sails-mssql/node_modules/mssql/node_modules/tedious/lib/connection.js:419:20)
at MessageIO.EventEmitter.emit (events.js:92:17)
at MessageIO.eventData (TestApp/node_modules/sails-mssql/node_modules/mssql/node_modules/tedious/lib/message-io.js:59:21)
at Socket. (TestApp/node_modules/sails-mssql/node_modules/mssql/node_modules/tedious/lib/message-io.js:3:59)
at Socket.EventEmitter.emit (events.js:95:17)
at Socket. (_stream_readable.js:746:14)
at Socket.EventEmitter.emit (events.js:92:17)
at emitReadable_ (_stream_readable.js:408:10)
at emitReadable (_stream_readable.js:404:5)
at readableAddChunk (_stream_readable.js:165:9)
at Socket.Readable.push (_stream_readable.js:127:10)
at TCP.onread (net.js:526:21)
Given the system doesn't throw an error the "Incorrect syntax near the keyword 'user'" when I use an invalid user, I think the first error message is a red herring.
Any thoughts on how to fix this?
Solved it.
Turns out user didn't have anything to do with the user logging in to the database (the 'user' setting in config/adapters.js).
I had created a model and controller called user (sails generate user). After connecting to the database, sails was trying to add the 'createdAt' and 'updatedAt' fields to the user table. But the database user I was connecting with did not have write permissions, so it was throwing an error.
Once I created the correct columns in the database, everything worked fine.
Related
I have implemented a custom idp class extending AbstractIdentityProviderMapper .
and i am getting below error while building and i am using keycloak 17 :
ERROR: Failed to run 'build' command.
ERROR: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
[error]: Build step io.quarkus.deployment.steps.MainClassBuildStep#build threw an exception: java.lang.RuntimeException: Failed to record call to method public void org.keycloak.quarkus.runtime.KeycloakRecorder.configSessionFactory(java.util.Map,java.util.Map,java.util.Map,java.lang.Boolean)
at io.quarkus.deployment.recording.BytecodeRecorderImpl.writeBytecode(BytecodeRecorderImpl.java:509)
at io.quarkus.deployment.steps.MainClassBuildStep.writeRecordedBytecode(MainClassBuildStep.java:444)
Entire Problem statement is well mentioned here
I have implemented a abstractIdentityProvider mapper to call logic execution upon authentication from external idp .
I'm using dbeaver to connect to a postgres database. When I attempt to connect I get this
"received fatal error: decrypt_error".
I've never seen this error before and am not too sure how to resolve it.
I added a sql file to my project and now I am receiving the following error:
nested exception is org.flywaydb.core.api.FlywayException: Validate failed: Detected failed migration to version 1.0.9 (update)
Here is my sql file I'm adding:
ALTER TABLE `episodes`
ADD COLUMN `rating` TINYINT(1) NULL DEFAULT NULL;
I added the same query to MySQL Workbench and it's working fine, so I think the error here is beyond the sql file added
UPDATE: full stack trace below
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'flywayInitializer' defined in class path resource [org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration$FlywayConfiguration.class]: Invocation of init method failed; nested exception is org.flywaydb.core.api.FlywayException: Validate failed: Detected failed migration to version 1.0.9 (update)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1708)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:581)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:503)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:304)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1089)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:859)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:395)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:327)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1255)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1243)
at com.nbcuni.cds.Application.main(Application.java:12)
Caused by: org.flywaydb.core.api.FlywayException: Validate failed: Detected failed migration to version 1.0.9 (update)
at org.flywaydb.core.Flyway.doValidate(Flyway.java:1286)
at org.flywaydb.core.Flyway.access$100(Flyway.java:71)
at org.flywaydb.core.Flyway$1.execute(Flyway.java:1176)
at org.flywaydb.core.Flyway$1.execute(Flyway.java:1168)
at org.flywaydb.core.Flyway.execute(Flyway.java:1655)
at org.flywaydb.core.Flyway.migrate(Flyway.java:1168)
at org.springframework.boot.autoconfigure.flyway.FlywayMigrationInitializer.afterPropertiesSet(FlywayMigrationInitializer.java:66)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1767)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1704)
... 18 common frames omitted
UPDATE: When I run mvn:flyway-validate, I receive the following error:
org.flywaydb.core.api.FlywayException: Unable to connect to the database. Configure the url, user and password!
I'm not sure where to configure it? It's already set in my applications.properties file? And w/o this version the spring application is working fine
I guess the problem is the error in migration history saved on your database.
Try deleting the line that failed and try again. If the error won't vanish, the problem is somehow in your statement.
I just had the same issue :)
below resolved the validate problem for me:
mvn flyway:validate -Dflyway.configFile=myFlywayConfig.properties
The error happen if there is any record is inserted into the 'flyway_schema_history' with failed status or part of the failed migration might already run. Just need to remove failed recored from the 'flyway_schema_history' then run "flyway migrate" again.
Query to flyway_schema_history table
select * from your_database_name.flyway_schema_history
You will get something like this:
Remove the record with success =0 and run again "flyway migrate".
Note, that this table might have a different name depending on the configuration
Getting error in spinnaker when we start the web-ui.
Get stuck too much. The error i got is:
vendor.bundle.js:9331 Uncaught Error: [$injector:modulerr] Failed to instantiate module netflix.spinnaker due to:
Error: [$injector:modulerr] Failed to instantiate module spinnaker.core due to:
Error: [$injector:modulerr] Failed to instantiate module spinnaker.core.notification.types due to:
TypeError: Cannot read property 'email' of undefined at Object.register
thanks .
What spinnaker version do you run?
Upgrade spinnaker first
perhaps use Minnaker OSS to get started faster for PoC.
I am using bigcommerce stencil and have started working on it and run command "stencil start" and got this error:
Debug: internal, implementation, error
TypeError: Uncaught error:self.assembler.getTranslations is not a
function
Also check in local (http://localhost:3000/) got below error
{"statusCode":500,"error":"Internal Server Error","message":"An
internal server error occurred"}
Can any body help me why I am getting this error?