Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to upload the registration data which consist the Subject Type form element. #727

Closed
Tracked by #1597
sachsk opened this issue May 13, 2024 · 4 comments
Closed
Tracked by #1597
Assignees

Comments

@sachsk
Copy link
Member

sachsk commented May 13, 2024

Issue:

Having trouble while uploading data using CSV. The error message says: "java.lang.Exception: Error in rule server. Message: 'Request failed with status code 403'."

CSV :- cini school teacher.csv
username: sachink@cini_uat

Analysis:

  • Looks like server is unable to contact the rules server though the user has all privileges. Doesn't seem to be related to Subject Type form element.

Stack trace:-

    at createError (/opt/rules-server/node_modules/axios/lib/core/createError.js:16:15)
    at settle (/opt/rules-server/node_modules/axios/lib/core/settle.js:17:12)
    at IncomingMessage.handleStreamEnd (/opt/rules-server/node_modules/axios/lib/adapters/http.js:244:11)
    at IncomingMessage.emit (events.js:203:15)
    at endReadableNT (_stream_readable.js:1145:12)
    at process._tickCallback (internal/process/next_tick.js:63:19)"

java.lang.Exception: Error in rule server. Message: "Request failed with status code 403", Stack: "Error: Request failed with status code 403
    at createError (/opt/rules-server/node_modules/axios/lib/core/createError.js:16:15)
    at settle (/opt/rules-server/node_modules/axios/lib/core/settle.js:17:12)
    at IncomingMessage.handleStreamEnd (/opt/rules-server/node_modules/axios/lib/adapters/http.js:244:11)
    at IncomingMessage.emit (events.js:203:15)
    at endReadableNT (_stream_readable.js:1145:12)
    at process._tickCallback (internal/process/next_tick.js:63:19)"
	at org.avni.server.importer.batch.csv.creator.RuleServerInvoker.invokeRuleServer(RuleServerInvoker.java:60)
	at org.avni.server.importer.batch.csv.creator.RuleServerInvoker.getRuleServerResult(RuleServerInvoker.java:67)
	at org.avni.server.importer.batch.csv.writer.SubjectWriter.write(SubjectWriter.java:128)
	at org.avni.server.importer.batch.csv.writer.SubjectWriter.write(SubjectWriter.java:90)
	at org.avni.server.importer.batch.csv.writer.CsvFileItemWriter.write(CsvFileItemWriter.java:62)
	at org.avni.server.importer.batch.csv.writer.CsvFileItemWriter$$FastClassBySpringCGLIB$$de932b0e.invoke(<generated>)
	at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
	at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:747)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
	at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:136)
	at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:124)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
	at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:689)
	at org.avni.server.importer.batch.csv.writer.CsvFileItemWriter$$EnhancerBySpringCGLIB$$a1a831d8.write(<generated>)
	at org.springframework.batch.core.step.item.SimpleChunkProcessor.writeItems(SimpleChunkProcessor.java:185)
	at org.springframework.batch.core.step.item.FaultTolerantChunkProcessor.scan(FaultTolerantChunkProcessor.java:580)
	at org.springframework.batch.core.step.item.FaultTolerantChunkProcessor.access$900(FaultTolerantChunkProcessor.java:52)
	at org.springframework.batch.core.step.item.FaultTolerantChunkProcessor$5.recover(FaultTolerantChunkProcessor.java:412)
	at org.springframework.retry.support.RetryTemplate.handleRetryExhausted(RetryTemplate.java:512)
	at org.springframework.retry.support.RetryTemplate.doExecute(RetryTemplate.java:351)
	at org.springframework.retry.support.RetryTemplate.execute(RetryTemplate.java:211)
	at org.springframework.batch.core.step.item.BatchRetryTemplate.execute(BatchRetryTemplate.java:217)
	at org.springframework.batch.core.step.item.FaultTolerantChunkProcessor.write(FaultTolerantChunkProcessor.java:422)
	at org.springframework.batch.core.step.item.SimpleChunkProcessor.process(SimpleChunkProcessor.java:209)
	at org.springframework.batch.core.step.item.ChunkOrientedTasklet.execute(ChunkOrientedTasklet.java:75)
	at org.springframework.batch.core.step.tasklet.TaskletStep$ChunkTransactionCallback.doInTransaction(TaskletStep.java:406)
	at org.springframework.batch.core.step.tasklet.TaskletStep$ChunkTransactionCallback.doInTransaction(TaskletStep.java:330)
	at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:140)
	at org.springframework.batch.core.step.tasklet.TaskletStep$2.doInChunkContext(TaskletStep.java:272)
	at org.springframework.batch.core.scope.context.StepContextRepeatCallback.doInIteration(StepContextRepeatCallback.java:81)
	at org.springframework.batch.repeat.support.RepeatTemplate.getNextResult(RepeatTemplate.java:375)
	at org.springframework.batch.repeat.support.RepeatTemplate.executeInternal(RepeatTemplate.java:215)
	at org.springframework.batch.repeat.support.RepeatTemplate.iterate(RepeatTemplate.java:145)
	at org.springframework.batch.core.step.tasklet.TaskletStep.doExecute(TaskletStep.java:257)
	at org.springframework.batch.core.step.AbstractStep.execute(AbstractStep.java:200)
	at org.springframework.batch.core.job.SimpleStepHandler.handleStep(SimpleStepHandler.java:148)
	at org.springframework.batch.core.job.flow.JobFlowExecutor.executeStep(JobFlowExecutor.java:66)
	at org.springframework.batch.core.job.flow.support.state.StepState.handle(StepState.java:67)
	at org.springframework.batch.core.job.flow.support.SimpleFlow.resume(SimpleFlow.java:169)
	at org.springframework.batch.core.job.flow.support.SimpleFlow.start(SimpleFlow.java:144)
	at org.springframework.batch.core.job.flow.FlowJob.doExecute(FlowJob.java:136)
	at org.springframework.batch.core.job.AbstractJob.execute(AbstractJob.java:308)
	at org.springframework.batch.core.launch.support.SimpleJobLauncher$1.run(SimpleJobLauncher.java:141)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:750)
@github-project-automation github-project-automation bot moved this to New Issues in Avni Product May 13, 2024
@mahalakshme mahalakshme moved this from New Issues to Ready in Avni Product May 13, 2024
@himeshr himeshr moved this from Ready to In Progress in Avni Product May 14, 2024
@himeshr himeshr self-assigned this May 14, 2024
himeshr added a commit that referenced this issue May 16, 2024
@himeshr
Copy link
Contributor

himeshr commented May 16, 2024

The issue was due to addition of new Privilege check as part of our Privileges over-haul done in 2022.
Corrected the privilege.

@sachsk As part of Subject creation via CSV, please specify UUID or ExternalId(LegacyId) for the SubjectType field "School", instead of specifying the name.

I was able to create a Teacher via below CSV Upload, using School UUID as value, in Staging env, Collectives for Integrated Livelihood Initiatives org.(Diff from Prod UAT org, subjectType names are not same).
UploadTeacher.csv

Teacher created: https://staging.avniproject.org/#/app/subject?uuid=d61e027e-d3e1-4059-b597-164b9579f4e2

@himeshr himeshr moved this from In Progress to Code Review Ready in Avni Product May 16, 2024
@mahalakshme
Copy link
Contributor

@himeshr what is the new privilege? Oh you mean no group other than Administrator group can have the 'All privileges' turned on and if it is, it will not be respected?

@himeshr
Copy link
Contributor

himeshr commented May 16, 2024

@himeshr what is the new privilege? Oh you mean no group other than Administrator group can have the 'All privileges' turned on and if it is, it will not be respected?

Its not all that complex.. its a minor change in the Privilege we check for.
See commit above for the change

@himeshr himeshr moved this from Code Review Ready to QA Ready in Avni Product May 16, 2024
@mahalakshme mahalakshme moved this from QA Ready to In Code Review in Avni Product May 16, 2024
@himeshr
Copy link
Contributor

himeshr commented May 16, 2024

Moved to QAReady, as its a 1 line code change to use a different Privilege.

@mahalakshme mahalakshme moved this from In Code Review to QA Ready in Avni Product May 16, 2024
@AchalaBelokar AchalaBelokar moved this from QA Ready to In QA in Avni Product May 17, 2024
@AchalaBelokar AchalaBelokar moved this from In QA to Done in Avni Product May 17, 2024
shraddha761 pushed a commit to shraddha761/avni-server that referenced this issue Jul 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

4 participants