keatontaylor / alexa-actions

A README and associated code to get actionable notifications setup for Alexa devices.
GNU General Public License v3.0
399 stars 187 forks source link

[Bug]: Pip failed to install dependencies! Something wrong in your requirements.txt file! #211

Closed dreimer1986 closed 12 months ago

dreimer1986 commented 12 months ago

Did you check our FAQ and Issue/PR for similar issues?

Contact Details

daniel.reimer@reactos.org

What happened?

I updated my Alexa Actions skill these days and first stumbled upon the missing sentry entry in reqirements.txt. You tried to fix that yesterday as it seems. First thing here. Shouldn't it be sentry-sdk instead of sentry? Regardless both cause the same error: Pip failed to install dependencies! Something wrong in your requirements.txt file!

If I change it from sentry>=1.32.0 to sentry-sdk it can be deployed, but then the logs are these:

See below.

If I comment out the three sentry imports and the new block a bit down below, the skill works fine, so it is not some faulty skill import in my case.

I fixed the problems.... SORT OF. I have no clue which sentry-sdk version Amazon adds here, but it works by adding

import logging

and changing the sentry block to the OLD variant here:

if ALLOW_ANONYMOUS_DATA_COLLECTION:
    sentry_sdk.init(
        dsn="https://5f56ef84a1063487a1b1c27f5b6f8391@o4506077312385024.ingest.sentry.io/4506077313630208",
        integrations=[
            AwsLambdaIntegration(),
            LoggingIntegration(
                level=logging.INFO,
                event_level=logging.ERROR
            )
        ],
        traces_sample_rate=0.1,
        _experiments={
          "profiles_sample_rate": 0.1,  # for versions before 1.17.0
        },
    )

Why? Because even with the added missing import it then complains about "profiles_sample_rate" not existing which made me google a bit more and then finding out that it is a sign of a a bit older version being used.

I hope this helps you to get things working for everyone including me, as I have no idea if my hacking really passed anything useful over to you now. ^^

Version

e48aa69

What Alexa device are you using?

Echo, Echo Show

What other Alexa device are you using?

No response

Relevant log output

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|   timestamp   |                                                                                                                                                                                                                                                                                                                                  message                                                                                                                                                                                                                                                                                                                                   |
|---------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| 1697855643148 | INIT_START Runtime Version: python:3.7.v37 Runtime Version ARN: arn:aws:lambda:eu-west-1::runtime:d5ec36c7d1563b32c740e027508255c34575daf61fd6861d99419d61404ab2f2                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| 1697855643645 | [ERROR] NameError: name 'logging' is not defined Traceback (most recent call last):   File "/var/lang/lib/python3.7/imp.py", line 234, in load_module     return load_source(name, filename, file)   File "/var/lang/lib/python3.7/imp.py", line 171, in load_source     module = _load(spec)   File "<frozen importlib._bootstrap>", line 696, in _load   File "<frozen importlib._bootstrap>", line 677, in _load_unlocked   File "<frozen importlib._bootstrap_external>", line 728, in exec_module   File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed   File "/var/task/lambda_function.py", line 67, in <module>     level=logging.INFO,  |
| 1697855645232 | [ERROR] NameError: name 'logging' is not defined Traceback (most recent call last):   File "/var/lang/lib/python3.7/imp.py", line 234, in load_module     return load_source(name, filename, file)   File "/var/lang/lib/python3.7/imp.py", line 171, in load_source     module = _load(spec)   File "<frozen importlib._bootstrap>", line 696, in _load   File "<frozen importlib._bootstrap>", line 677, in _load_unlocked   File "<frozen importlib._bootstrap_external>", line 728, in exec_module   File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed   File "/var/task/lambda_function.py", line 67, in <module>     level=logging.INFO,  |
| 1697855645388 | START RequestId: 3cb0c978-1cad-4dec-917e-fdcfb09c8c18 Version: 10                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| 1697855645389 | Unknown application error occurred Runtime.Unknown                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| 1697855645389 | END RequestId: 3cb0c978-1cad-4dec-917e-fdcfb09c8c18                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| 1697855645389 | REPORT RequestId: 3cb0c978-1cad-4dec-917e-fdcfb09c8c18 Duration: 1636.03 ms Billed Duration: 1637 ms Memory Size: 512 MB Max Memory Used: 36 MB                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| 1697855645477 | INIT_START Runtime Version: python:3.7.v37 Runtime Version ARN: arn:aws:lambda:eu-west-1::runtime:d5ec36c7d1563b32c740e027508255c34575daf61fd6861d99419d61404ab2f2                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| 1697855645888 | [ERROR] NameError: name 'logging' is not defined Traceback (most recent call last):   File "/var/lang/lib/python3.7/imp.py", line 234, in load_module     return load_source(name, filename, file)   File "/var/lang/lib/python3.7/imp.py", line 171, in load_source     module = _load(spec)   File "<frozen importlib._bootstrap>", line 696, in _load   File "<frozen importlib._bootstrap>", line 677, in _load_unlocked   File "<frozen importlib._bootstrap_external>", line 728, in exec_module   File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed   File "/var/task/lambda_function.py", line 67, in <module>     level=logging.INFO,  |
| 1697855647408 | [ERROR] NameError: name 'logging' is not defined Traceback (most recent call last):   File "/var/lang/lib/python3.7/imp.py", line 234, in load_module     return load_source(name, filename, file)   File "/var/lang/lib/python3.7/imp.py", line 171, in load_source     module = _load(spec)   File "<frozen importlib._bootstrap>", line 696, in _load   File "<frozen importlib._bootstrap>", line 677, in _load_unlocked   File "<frozen importlib._bootstrap_external>", line 728, in exec_module   File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed   File "/var/task/lambda_function.py", line 67, in <module>     level=logging.INFO,  |
| 1697855647552 | START RequestId: 9a3a1195-bed0-40ce-ac1c-db66fa376ce4 Version: 10                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| 1697855647568 | Unknown application error occurred Runtime.Unknown                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| 1697855647568 | END RequestId: 9a3a1195-bed0-40ce-ac1c-db66fa376ce4                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| 1697855647568 | REPORT RequestId: 9a3a1195-bed0-40ce-ac1c-db66fa376ce4 Duration: 1594.17 ms Billed Duration: 1595 ms Memory Size: 512 MB Max Memory Used: 33 MB                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
XcOM987 commented 12 months ago

The requirements file I used which worked was:

isodate==0.6.0 boto3==1.9.216 ask-sdk-core==1.11.0 pydantic==1.10.4

dreimer1986 commented 12 months ago

The requirements file I used which worked was:

isodate==0.6.0 boto3==1.9.216 ask-sdk-core==1.11.0 pydantic==1.10.4

Then you did not use the most recent code. Otherwise you would get this one as expected:

[ERROR] Runtime.ImportModuleError: Unable to import module 'lambda_function': No module named 'sentry_sdk' Traceback (most recent call last):
XcOM987 commented 12 months ago

Naa, I was trying to fix another issue and was trying to workout what one was needed, I used the requirements file from 0.10.1 which is the latest release, this is different to what is on the git repo though, but given I was looking at something else I relied on the released version: image

image

iGaneshKumar commented 12 months ago

Same for me, I replaced the HOME_ASSISTANT_URL with my URL and hit Deploy. And the deploy failed with below error.

image

Radushka commented 12 months ago

Unfortunately, same here on a freshly imported git and followed wiki to the tee:

Screenshot 2023-10-21 at 8 43 23 PM
DEADSEC-SECURITY commented 12 months ago

Fixed on master. Please use the new file

dreimer1986 commented 12 months ago

Well, sadly you did not. I made the changes as already explained (Quote from 1st post: "Shouldn't it be sentry-sdk instead of sentry? Regardless both cause the same error.") for a reason. This happens with the demanded version >= 1.32.0 of sentry-sdk:

log-events-viewer-result.csv

It ONLY deploys fine here if you do NOT force a version and then it seems to load a not very recent one. Thus I had to change to the pre-1.17.0 variant of profiles_sample_rate. And you need to "import logging" regardless of that. (Source and proof: https://docs.sentry.io/platforms/python/integrations/logging/)

DEADSEC-SECURITY commented 12 months ago

Updated the file, mind giving it a shot? Its very unstable rn and hasnt been tested but let me know. I would recommend using version 0.10.1. Master always contains unstable not fully tested stuff

DEADSEC-SECURITY commented 12 months ago

Tested on my instance and its installing properly so its no longer an issue.

dreimer1986 commented 12 months ago

Confirmed working. Thx :D