Error: The deployment failed to initialize due to a configuration or code error. Check the logs tab for more information. when trying to deploy

Question:
Getting this error when trying to deploy

error: The deployment failed to initialize due to a configuration or code error. Check the logs tab for more information. For additional support, please post on https://ask.replit.com/c/help/13 and a staff member will take a look.

Repl link/Link to where the bug appears:
https://replit.com/@QwertyQwerty88/Chat

Screenshots, links, or other helpful context:
Not a code issue, works fine in development

Error

2024-01-22T02:20:30Z info: Deployment: f7b46b38-9491-4a6e-8795-bbe3800548dc
2024-01-22T02:20:30Z info: Build: e72716f4-1273-44eb-9cbb-35b9d9a4f32f
2024-01-22T02:20:30Z info: Connecting to builder
2024-01-22T02:20:31Z info: Builder connected
2024-01-22T02:20:32Z info: Installing packages
2024-01-22T02:20:32Z info: Starting Build
2024-01-22T02:20:38Z info: Pushing pid1 binary layer...
2024-01-22T02:20:39Z info: Created pid1 binary layer
2024-01-22T02:20:41Z info: Skipping Python layer creation
2024-01-22T02:20:41Z info: Skipping Node layer creation
2024-01-22T02:20:41Z info: Pushing Repl layer...
2024-01-22T02:20:41Z info: Pushing hosting layer...
2024-01-22T02:20:41Z info: Retrieved cached nix layer
2024-01-22T02:20:41Z info: Created hosting layer
2024-01-22T02:20:52Z info: Created Repl layer
2024-01-22T02:20:52Z info: Pushing Repl (cache) layer...
2024-01-22T02:20:54Z info: Created Repl (cache) layer
2024-01-22T02:20:54Z info: Pushed image manifest
2024-01-22T02:20:55Z info: Pushed soci index manifest
2024-01-22T02:21:00Z info: Creating Autoscale service
starting up user application
2024-01-22T02:21:19Z error: The deployment failed to initialize due to a configuration or code error. Check the logs tab for more information. For additional support, please post on https://ask.replit.com/c/help/13 and a staff member will take a look.
Commands

Logs

image

  1. Make sure your “Start/run command” is correct.
  2. Deployments have this thing where you need to add the secrets on a separate UI that pops up (different from the secrets tab).

Uh, yeah, I sent the screenshot of both of those.

1 Like

Did you try deploying more than once?

Yes, I tried deploying twice.

@QwertyQwerty88 Did you get it to work? I saw it deployed when I checked. If not, feel free to invite me and we can take a closer look.

1 Like

No, I haven’t opened the Repl since yesterday.

I tried redepoying just now, still didn’t work.

Invited you.

@QwertyQwerty88 Still looking into this. It seems to be an issue with the modules (perhaps stemming from an older template). I tried migrating it to Nix but that didn’t resolve it. We think the psycopg2 module might be one of the culprits that isn’t being installed on the deployment for some reason.

I wanted to give you a progress update in case you wanted to do a bit of troubleshooting for yourself while the team looks into it further. I’ll let you know what we find out.

We’re also investigating the lack of logs which I’ve seen for a few “failed to promote” deployments now. We should almost always have logs for these situations.

2 Likes

Thanks. My Core’s finishing soon so even if you do figure it out I probably won’t be able to deploy it, but I would appreciate if you could find the issue and let me know.

1 Like

@QwertyQwerty88 I’ve invited you to a Repl that deploys, but with some disclaimers.

We converted it to Nix and added an env section in the .replit. It’s pretty ugly. Honestly, it might even be better to start a new Python Repl from scratch and just copy the code over rather than address the old template issues.

After doing that, there was a remaining error (which will show in the logs once we get that fix pushed out this week):

Traceback (most recent call last):
RuntimeError: The Werkzeug web server is not designed to run in production. Pass allow_unsafe_werkzeug=True to the run() method to disable this error.

Basically, Werkzeug is not designed for a production environment, and the typical way to circumvent it would be to deploy the application using a dedicated WSGI server like gunicorn or similar. For now, I am passing the unsafe flag just to confirm it deploys successfully, but it’s not recommended and you’ll probably want to update it.

1 Like

Doesn’t gunicorn have issues? IIRC there was a topic here about it not being in $PATH or something.

EDIT: there was, the solution there was to just use flask instead:

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.