-
-
Notifications
You must be signed in to change notification settings - Fork 18
Open
Labels
is: bugSomething isn't workingSomething isn't workingpackage: generatorGenerator packageGenerator packagepackage: serverServer packageServer package
Description
I am encountering errors when using the default subscription generated by the prisma-appsync package in the AWS AppSync console.
Error with Default Subscription
When trying to use a subscription, I receive the following error:
{
"errors": [
{
"message": "Connection failed: {\"errors\":[{\"errorType\":\"Error\",\"message\":\"{\\\"error\\\":\\\"sa[s.context.action] is not a function\\\",\\\"type\\\":\\\"INTERNAL_SERVER_ERROR\\\",\\\"code\\\":500}\"}]}"
}
]
}I found that if I manually update the subscription resolver to use <resourceName>NoneDataSource, the subscription works without errors. However, this manual change is reset after each deployment, which is not ideal.
Attempt to Use none DataSource
To avoid manual updates, I tried modifying(by extending and tweaking schema.prisma) the resolvers.yaml file to use datasource: none instead of datasource: prisma-appsync for subscriptions. However, running yarn dev results in the following error:
\node_modules\amplify-appsync-simulator\lib\resolvers\unit-resolver.js:12
throw new Error(`Invalid config for UNIT_RESOLVER ${JSON.stringify(config)} \n ${e.message}`);
^
Error: Invalid config for UNIT_RESOLVER {"typeName":"Subscription","fieldName":"onCreatedFile","dataSource":"none","dataSourceName":"none","kind":"UNIT","requestMappingTemplateLocation":"lambdaRequest.vtl","responseMappingTemplateLocation":"lambdaResponse.vtl"}
Missing data source none
at new AppSyncUnitResolver (\node_modules\amplify-appsync-simulator\src\resolvers\unit-resolver.ts:12:13)
at \node_modules\amplify-appsync-simulator\src\index.ts:106:15
at Array.reduce (<anonymous>)
at AmplifyAppSyncSimulator.init (\node_modules\amplify-appsync-simulator\src\index.ts:98:49)
at Object.start (\node_modules\prisma-appsync\dist\server\index.js:22:3466)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at Proxy.createServer (\node_modules\prisma-appsync\dist\server\index.js:22:4301)
Questions
- If I decide to use
datasource: prisma-appsyncfor subscriptions to avoid manual updates, what changes are required to fix the first error ("sa[s.context.action] is not a function")? - Is it valid to use
datasource: nonefor subscriptions by extending the schema? If so, how can I resolve theInvalid config for UNIT_RESOLVERerror?
If further details are needed, I’m happy to provide them. Thank you in advance for your help!
Metadata
Metadata
Assignees
Labels
is: bugSomething isn't workingSomething isn't workingpackage: generatorGenerator packageGenerator packagepackage: serverServer packageServer package