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

[emails & messages] tRPC internal server error while saving configuration #1135

Open
madmonkeyworks opened this issue Dec 11, 2023 · 3 comments

Comments

@madmonkeyworks
Copy link

madmonkeyworks commented Dec 11, 2023

Hi there,

I am self-hosting the Emails & Messages Saleor app and testing it in Saleor dev sandbox.
When saving email provider configuration, an internal server error pops up.
This error appears only in Saleor dev sandbox. Local deployment on saleor-platform works well.

Setup

  • Saleor dev sandbox
  • Emails & Messages app deployed on AWS Amplify
  • Custom APL using AWS graphql (dynamo DB)

Steps to reproduce

  1. Self-host Emails & Messages app (in my case it's AWS Amplify)
  2. Go to app configuration
  3. Enter details for "SMTP server" > hit save [configuration successfully saved]
  4. Enter details for "Sender" > hit save [saving configuration fails with error 500]

Error

"name": "tRPC error",
"err": {
        "type": "TRPCError",
        "message": "Internal server error",
        "stack": "TRPCError: Internal server error\n    at throwTrpcErrorFromConfigurationServiceError (/tmp/app/.next/server/pages/api/trpc/[trpc].js:918:11)\n    at /tmp/app/.next/server/pages/api/trpc/[trpc].js:1101:20\n    at processTicksAndRejections (node:internal/process/task_queues:96:5)\n    at async resolveMiddleware (file:///var/task/node_modules/@trpc/server/dist/index.mjs:420:30)\n    at async callRecursive (file:///var/task/node_modules/@trpc/server/dist/index.mjs:456:32)\n    at async callRecursive (file:///var/task/node_modules/@trpc/server/dist/index.mjs:456:32)\n    at async /tmp/app/.next/server/pages/api/trpc/[trpc].js:1230:20\n    at async callRecursive (file:///var/task/node_modules/@trpc/server/dist/index.mjs:456:32)\n    at async callRecursive (file:///var/task/node_modules/@trpc/server/dist/index.mjs:456:32)\n    at async callRecursive (file:///var/task/node_modules/@trpc/server/dist/index.mjs:456:32)",
        "code": "INTERNAL_SERVER_ERROR",
        "name": "TRPCError"
    },
"msg": "smtpConfiguration.updateSender returned error:"

As I mentioned, all works well in local development, i.e. saleor-platform + app via localhost, with both custom APL and file APL. It's only the Saleor dev sandbox and app deployed on AWS which trows the error.

Can you help?

@lkostrowski
Copy link
Member

Please set APP_LOG_LEVEL=trace and check if you have some logs in the console

@madmonkeyworks
Copy link
Author

Thanks for the tip @lkostrowski.
Below is the trace log. All looks ok to me, until the crash on "smtpConfiguration.updateSender".
Any idea what's going on?

{
    "level": 20,
    "time": 1702414790130,
    "pid": 52,
    "hostname": "169.254.83.125",
    "name": "AwsGraphQLAPL",
    "msg": "AuthData successfully retrieved."
}
{
    "level": 20,
    "time": 1702414790130,
    "pid": 52,
    "hostname": "169.254.83.125",
    "permissions": [
        "MANAGE_APPS"
    ],
    "msg": "Calling validateClientToken middleware with permissions required"
}
{
    "level": 20,
    "time": 1702414790130,
    "pid": 52,
    "hostname": "169.254.83.125",
    "msg": "trying to verify JWT token from frontend"
}
{
    "level": 20,
    "time": 1702414790130,
    "pid": 52,
    "hostname": "169.254.83.125",
    "token": "[Redacted]"
}
{
    "level": 20,
    "time": 1702414790389,
    "pid": 52,
    "hostname": "169.254.83.125",
    "saleorApiUrl": "https://santafoodev.eu.saleor.cloud/graphql/",
    "id": "1702414701563e9cxw",
    "senderEmail": "santafoo-dev-admin@aarini.com",
    "senderName": "Santafoo DEV",
    "msg": "smtpConfigurationRouter.updateSender called"
}
{
    "level": 20,
    "time": 1702414790389,
    "pid": 52,
    "hostname": "169.254.83.125",
    "name": "SmtpConfigurationService",
    "msg": "Update configuration"
}
{
    "level": 20,
    "time": 1702414790389,
    "pid": 52,
    "hostname": "169.254.83.125",
    "name": "SmtpConfigurationService",
    "msg": "Get configuration"
}
{
    "level": 20,
    "time": 1702414790389,
    "pid": 52,
    "hostname": "169.254.83.125",
    "name": "SmtpConfigurationService",
    "msg": "Get configuration root"
}
{
    "level": 20,
    "time": 1702414790389,
    "pid": 52,
    "hostname": "169.254.83.125",
    "name": "SmtpConfigurationService",
    "msg": "Fetch configuration from Saleor API"
}
{
    "level": 20,
    "time": 1702414790389,
    "pid": 52,
    "hostname": "169.254.83.125",
    "name": "SmtpPrivateMetadataManager",
    "msg": "Fetching config in the current version"
}
{
    "level": 20,
    "time": 1702414790732,
    "pid": 52,
    "hostname": "169.254.83.125",
    "name": "SmtpConfigurationService",
    "msg": "Get configuration root"
}
{
    "level": 20,
    "time": 1702414790732,
    "pid": 52,
    "hostname": "169.254.83.125",
    "name": "SmtpConfigurationService",
    "msg": "Using cached configuration"
}
{
    "level": 50,
    "time": 1702414790733,
    "pid": 52,
    "hostname": "169.254.83.125",
    "name": "tRPC error",
    "err": {
        "type": "TRPCError",
        "message": "Internal server error",
        "stack": "TRPCError: Internal server error\n    at throwTrpcErrorFromConfigurationServiceError (/tmp/app/.next/server/pages/api/trpc/[trpc].js:916:11)\n    at /tmp/app/.next/server/pages/api/trpc/[trpc].js:1096:20\n    at processTicksAndRejections (node:internal/process/task_queues:96:5)\n    at async resolveMiddleware (file:///var/task/node_modules/@trpc/server/dist/index.mjs:420:30)\n    at async callRecursive (file:///var/task/node_modules/@trpc/server/dist/index.mjs:456:32)\n    at async callRecursive (file:///var/task/node_modules/@trpc/server/dist/index.mjs:456:32)\n    at async /tmp/app/.next/server/pages/api/trpc/[trpc].js:1225:20\n    at async callRecursive (file:///var/task/node_modules/@trpc/server/dist/index.mjs:456:32)\n    at async callRecursive (file:///var/task/node_modules/@trpc/server/dist/index.mjs:456:32)\n    at async callRecursive (file:///var/task/node_modules/@trpc/server/dist/index.mjs:456:32)",
        "code": "INTERNAL_SERVER_ERROR",
        "name": "TRPCError"
    },
    "msg": "smtpConfiguration.updateSender returned error:"
}

@lkostrowski
Copy link
Member

At the moment only I can help is that you check the error source (updateSender procedure) and try to log the error. Looks like its missing in the logs. I'd be great if you open the PR if you have the fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants