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

Console CI/CD backend deployment fails for Python Lambda (Unable to import module) #13349

Closed
dcfranca opened this issue Jan 20, 2021 · 20 comments
Labels
pending-triage Issue is pending triage transferred This issue was transferred from another Amplify project

Comments

@dcfranca
Copy link

** Please describe which feature you have a question about? **
Ok, not exactly a cat dying, but I didn't know how to summarize it on the headline, so I decided to go with a clickbait.
To be honest, I don't know if this question fit best here or on amplify-cli, feel free to move it if needed.

I have the following scenario:
2 branches, each branch is linked to an Amplify environment
Branch: dev -> Amplify env: dev
Branch: master -> Amplify env: staging

They are connected via Amplify Console, so every time something is pushed to them, they deploy the environment, backend and frontend.

I have a lambda function, created via Amplify, which uses is a Python function, and uses docxtpl package, which uses MarkupSafe

I have a Pipfile with the following:

[packages]
docxtpl = "*"

Whenever I push the backend via amplify-cli it works fine, and my function works as expected.
However, every time I deploy it via amplify console (which means every time I update the branches), my function breaks, and I start getting the following errors on my logs:

Unable to import module 'index': No module named 'markupsafe'

What I sometimes do is adding this line to my Pipfile:

MarkupSafe = "*"

and pushing locally the backend again

But, tbh, I don't think this is the solution, it is just because it recognizes something has changed in the function and then re-deploy, because when I remove the MarkupSafe works as well

It is happening every time I happen to deploy, it is really annoying having to do it every time
Any clue what I can do to fix once for all? Or at least where to look for better debugging information?

Thanks

** Provide additional details**

@hsspain
Copy link
Contributor

hsspain commented Jan 20, 2021

@dcfranca We will look into this. Can you provide your App ID and region?

@dcfranca
Copy link
Author

@hsspain any email I can send this information to?

@hsspain
Copy link
Contributor

hsspain commented Jan 21, 2021

@dcfranca
Copy link
Author

dcfranca commented Jan 21, 2021

@hsspain Sent, let me know if you need anything else.

@dcfranca
Copy link
Author

dcfranca commented Feb 6, 2021

@swaminator Any update on this issue?

I confirm that the dependencies files has nothing to do with the bug, even if I just change a counter variable and push from amplify cli it works

@dcfranca
Copy link
Author

dcfranca commented Feb 16, 2021

@hsspain @swaminator Anyone?

@dcfranca
Copy link
Author

@ganipcanot
Copy link

Closing due to age - please re-open if still experiencing issues.

@dcfranca
Copy link
Author

dcfranca commented Jul 27, 2021

@ganipcanot I don't understand why this was closed, I'm still waiting for response, and yes, I'm still experiencing this issue

@siegerts
Copy link
Contributor

Hi @dcfranca, apologies for closing this. Reopening now to track alongside the issue that you've experienced in the CLI. We can always transfer, if needed. Also, just readjusting the title a bit to be more representative (😄 ), so that other customers are able to find if they are experiencing the same.

@siegerts siegerts reopened this Jul 29, 2021
@siegerts siegerts changed the title Every time a backend deployment happen from the console CI/CD a cat dies Console CI/CD backend deployment fails for Python Lambda (Unable to import module) Jul 29, 2021
@dcfranca
Copy link
Author

@siegerts Thanks :)

@Jordan-Mesches
Copy link

I have the exact same problem, in my staging branch where I push the backend using the cli works completely fine, but in my prod branch's backend( which get's pushed in the console when it see's a new git commit), doesn't work and says Runtime.ImportModuleError: Unable to import module 'index': No module named 'markupsafe'

@dcfranca
Copy link
Author

Thanks @Jordan-Mesches, now I don't feel so alone with this issue :D
It seems to be direct related to the markupsafe dependency for some reason

@Jordan-Mesches
Copy link

So has anyone figured out a solution to this problem?

@dcfranca
Copy link
Author

dcfranca commented Sep 2, 2021

@Jordan-Mesches Unfortunately, it doesn't seem so =/

@stemwinder
Copy link

stemwinder commented May 21, 2022

This is also occurring for us across three lambdas we are trying to add to our Amplify project. None of the three are picked up by Amplify Console when it creates virtual environments and builds the functions.

EDIT: I was able to correct this by manually adding an amplify.state file to the root of the Lambdas' directories.

@siegerts siegerts transferred this issue from aws-amplify/amplify-hosting Oct 19, 2023
@josefaidt josefaidt added pending-triage Issue is pending triage transferred This issue was transferred from another Amplify project labels Oct 19, 2023
@josefaidt
Copy link
Contributor

Hey @dcfranca and @stemwinder apologies for the delay here, but I wanted to confirm whether y'all were still experiencing this issue?

@josefaidt josefaidt added the pending-response Issue is pending response from the issue author label Oct 24, 2023
@dcfranca
Copy link
Author

Hey @dcfranca and @stemwinder apologies for the delay here, but I wanted to confirm whether y'all were still experiencing this issue?

I haven't used Amplify for years now, so I don't know if this is still happening

@github-actions github-actions bot removed the pending-response Issue is pending response from the issue author label Oct 24, 2023
@josefaidt
Copy link
Contributor

Sorry about that @dcfranca I know it's been a few years on this one :/ I'll close this out for now as we have not received recent reports around this behavior, but will keep it in mind the event we do receive a report

@josefaidt josefaidt closed this as not planned Won't fix, can't repro, duplicate, stale Oct 26, 2023
@github-actions
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pending-triage Issue is pending triage transferred This issue was transferred from another Amplify project
Projects
None yet
Development

No branches or pull requests

7 participants