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

Error running on enterprise: No module named 'wsgi_handler' #124

Open
revmischa opened this issue Jan 16, 2020 · 9 comments
Open

Error running on enterprise: No module named 'wsgi_handler' #124

revmischa opened this issue Jan 16, 2020 · 9 comments

Comments

@revmischa
Copy link
Contributor

revmischa commented Jan 16, 2020

SERVERLESS_ENTERPRISE {
    "type": "error",
    "origin": "sls-agent",
    "payload": {
        "duration": 18.58663558959961,
        "endTime": "2020-01-16T09:40:31.293156Z",
        "logs": {},
        "operationName": "s-transaction-function",
        "schemaType": "s-span",
        "schemaVersion": "0.0",
        "spanContext": {
            "spanId": "a498db0a-2dc3-42a7-97f3-2e3c33488729",
            "traceId": "50ecfe10-ca80-476c-ba67-37652fdea771",
            "xTraceId": "Root=1-5e202f8e-2a349ce0ce1e4728ec9d4798;Parent=305f956236e9e01d;Sampled=1"
        },
        "spans": [],
        "eventTags": [],
        "startTime": "2020-01-16T09:40:31.291752Z",
        "tags": {
            "appUid": "DFlxbwPZ376gpP8GZM",
            "applicationName": "hr-tool",
            "computeContainerUptime": 209.27810668945312,
            "computeCustomArn": "arn:aws:lambda:eu-west-1:111:function:hr-dev-app",
            "computeCustomAwsRequestId": "50ecfe10-ca80-476c-ba67-37652fdea771",
            "computeCustomEnvArch": "64bit",
            "computeCustomEnvCpus": null,
            "computeCustomEnvMemoryFree": 505692160,
            "computeCustomEnvMemoryTotal": 649015296,
            "computeCustomEnvPlatform": "linux",
            "computeCustomFunctionName": "hr-dev-app",
            "computeCustomFunctionVersion": "$LATEST",
            "computeCustomInvokeId": null,
            "computeCustomLogGroupName": "/aws/lambda/hr-dev-app",
            "computeCustomLogStreamName": "2020/01/16/[$LATEST]d29ef2abd3514ff48a04960cb82c2d80",
            "computeCustomMemorySize": "512",
            "computeCustomRegion": "eu-west-1",
            "computeCustomSchemaType": "s-compute-aws-lambda",
            "computeCustomSchemaVersion": "0.0",
            "computeCustomXTraceId": "Root=1-5e202f8e-2a349ce0ce1e4728ec9d4798;Parent=305f956236e9e01d;Sampled=1",
            "computeInstanceInvocationCount": 1,
            "computeIsColdStart": true,
            "computeMemoryPercentageUsed": 0.2208316766697591,
            "computeMemorySize": "512",
            "computeMemoryUsed": null,
            "computeRegion": "eu-west-1",
            "computeRuntime": "aws.lambda.python.3.7.5",
            "computeType": "aws.lambda",
            "eventCustomStage": "dev",
            "eventSource": null,
            "eventTimestamp": "2020-01-16T09:40:31.291752Z",
            "eventType": "unknown",
            "functionName": "hr-dev-app",
            "schemaType": "s-transaction-function",
            "schemaVersion": "0.0",
            "serviceName": "hr",
            "stageName": "dev",
            "tenantId": "revmischa",
            "tenantUid": "6BjwgW8ppgFxcTwCVH",
            "pluginVersion": "3.2.7",
            "timeout": 10,
            "timestamp": "2020-01-16T09:40:31.291752Z",
            "traceId": "50ecfe10-ca80-476c-ba67-37652fdea771",
            "transactionId": "a498db0a-2dc3-42a7-97f3-2e3c33488729",
            "errorCulprit": "_find_and_load_unlocked (<frozen importlib._bootstrap>)",
            "errorExceptionMessage": "No module named 'wsgi_handler'",
            "errorExceptionStacktrace": "[{\"filename\": \"<frozen importlib._bootstrap>\", \"lineno\": 965, \"function\": \"_find_and_load_unlocked\", \"library_frame\": false, \"abs_path\": \"/var/task/<frozen importlib._bootstrap>\", \"pre_context\": [], \"context_line\": \"\", \"post_context\": []}, {\"filename\": \"<frozen importlib._bootstrap>\", \"lineno\": 983, \"function\": \"_find_and_load\", \"library_frame\": false, \"abs_path\": \"/var/task/<frozen importlib._bootstrap>\", \"pre_context\": [], \"context_line\": \"\", \"post_context\": []}, {\"filename\": \"<frozen importlib._bootstrap>\", \"lineno\": 1006, \"function\": \"_gcd_import\", \"library_frame\": false, \"abs_path\": \"/var/task/<frozen importlib._bootstrap>\", \"pre_context\": [], \"context_line\": \"\", \"post_context\": []}, {\"filename\": \"/var/lang/lib/python3.7/importlib/__init__.py\", \"lineno\": 127, \"function\": \"import_module\", \"library_frame\": false, \"abs_path\": \"/var/lang/lib/python3.7/importlib/__init__.py\", \"pre_context\": [], \"context_line\": \"return _bootstrap._gcd_import(name[level:], package, level)\", \"post_context\": []}, {\"filename\": \"/var/task/serverless_sdk/__init__.py\", \"lineno\": 53, \"function\": \"get_user_handler\", \"library_frame\": false, \"abs_path\": \"/var/task/serverless_sdk/__init__.py\", \"pre_context\": [], \"context_line\": \"user_module = import_module(user_module_name)\", \"post_context\": []}, {\"filename\": \"/var/task/s_app.py\", \"lineno\": 14, \"function\": \"<module>\", \"library_frame\": false, \"abs_path\": \"/var/task/s_app.py\", \"pre_context\": [], \"context_line\": \"user_handler = serverless_sdk.get_user_handler('wsgi_handler.handler')\", \"post_context\": []}, {\"filename\": \"/var/task/s_app.py\", \"lineno\": 19, \"function\": \"error_handler\", \"library_frame\": false, \"abs_path\": \"/var/task/s_app.py\", \"pre_context\": [], \"context_line\": \"raise e\", \"post_context\": []}, {\"filename\": \"/var/task/serverless_sdk/__init__.py\", \"lineno\": 107, \"function\": \"wrapped_handler\", \"library_frame\": false, \"abs_path\": \"/var/task/serverless_sdk/__init__.py\", \"pre_context\": [], \"context_line\": \"return user_handler(event, context)\", \"post_context\": []}, {\"filename\": \"/var/task/serverless_sdk/__init__.py\", \"lineno\": 356, \"function\": \"transaction\", \"library_frame\": false, \"abs_path\": \"/var/task/serverless_sdk/__init__.py\", \"pre_context\": [], \"context_line\": \"yield\", \"post_context\": []}]",
            "errorExceptionType": "ModuleNotFoundError",
            "errorId": "ModuleNotFoundError!$No module named 'wsgi_handler'",
            "errorFatal": true
        }
    },
    "requestId": "50ecfe10-ca80-476c-ba67-37652fdea771",
    "schemaVersion": "0.0",
    "timestamp": "2020-01-16T09:40:31.293156Z"
}
  File "<frozen importlib._bootstrap>", line 965, in _find_and_load_unlockedmodule
@revmischa
Copy link
Contributor Author

It runs okay if I deploy it without enterprise

@logandk
Copy link
Owner

logandk commented Jan 16, 2020

I haven't tried Serverless Enterprise. Is there a way to test and replicate this for free?

@revmischa
Copy link
Contributor Author

it's free to try. just run serverless login

@brett-matthews

This comment has been minimized.

@revmischa
Copy link
Contributor Author

@brett-matthews we're seeing that behavior too

Im not sure if this is related, but when i execute;

sls wsgi serve

All good..

But when I deploy it I see this in CloudWatch;

    "errorType": "Runtime.ImportModuleError",
    "errorMessage": "Error: Cannot find module 'wsgi_handler'\nRequire stack:\n- /var/runtime/UserFunction.js\n- /var/runtime/index.js",
    "stack": [
        "Runtime.ImportModuleError: Error: Cannot find module 'wsgi_handler'",
        "Require stack:",
        "- /var/runtime/UserFunction.js",
        "- /var/runtime/index.js",
        "    at _loadUserApp (/var/runtime/UserFunction.js:100:13)",
        "    at Object.module.exports.load (/var/runtime/UserFunction.js:140:17)",
        "    at Object.<anonymous> (/var/runtime/index.js:43:30)",
        "    at Module._compile (internal/modules/cjs/loader.js:956:30)",
        "    at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)",
        "    at Module.load (internal/modules/cjs/loader.js:812:32)",
        "    at Function.Module._load (internal/modules/cjs/loader.js:724:14)",
        "    at Function.Module.runMain (internal/modules/cjs/loader.js:1025:10)",
        "    at internal/main/run_main_module.js:17:11"
    ]
}

@logandk
Copy link
Owner

logandk commented Feb 13, 2020

I'm hoping to look into this very soon, will give it a try on Enterprise

@mikealche
Copy link

I'm also getting this just trying to run the Flask HTTP API example with the serverless offline plugin

@logandk
Copy link
Owner

logandk commented Oct 6, 2022

@mikealche Run sls wsgi install before sls offline

@HumbertoSilv
Copy link

@mikealcheCorra sls wsgi installantessls offline

This worked perfectly for me, however I didn't understand the difference between 'sls wsgi install' and 'serverless-wsgi' and couldn't find anything by searching.

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

No branches or pull requests

5 participants