DEPLOY
goatkenziee
PROOP

a month ago

I HAVE BEEN UNABLE TO DEPLOY FOR WEEKS SOEMTHING IS WROG HERE ALL MY OLD CODE WOLD SHOW UPDATES ETC ON REPLIT BUT EVEN MY CHANGES I AKE INSIDE CURSOR AND MYSELF WONT SHOW OR UPDATE AND ALLOW MY FIXES TO FLOW HERE RAILWWAY WONT SHOW ANYTHING I EVEN ATTEMPTED JSUT A CLOR CHNAGE INTO A SMALL SECTION TO SEE RAILWY DOS NOT SHOW CHNAGES AND FEATURES THAT ARE BROKE THEY KEEP BROKE HELP FIX

Closed$10 Bounty

22 Replies

Railway
BOT

a month ago

Hey there! We've found the following might help you get unblocked faster:

If you find the answer from one of these, please let us know by solving the thread!


goatkenziee
PROOP

a month ago

DID NOT HELP


goatkenziee
PROOP

a month ago

CAN SOMEONE PLEASE HELP I HAVE SPENT 10-16 HOURS AT DAYS WORKING AT THE SAME THING DEPLOYMENTS I MAKE CODE CHNAGES I MAKE NOTHING CHNAGES ON DEPLOYMENT AND EVRY LITTLE BUTTON IS BROKEN IT SEND E ERROS MESAGES FOR EVRYTHING CHECKOUT UPGRADING LITERLLY NOTHING WORKS!... I HOPE SOMEOEN SEES THIS


noahd
EMPLOYEE

a month ago

This thread has been marked as public for community involvement, as it does not contain any sensitive or personal information. Any further activity in this thread will be visible to everyone.

Status changed to Open noahd about 1 month ago


dev
MODERATOR

a month ago

Could you provide screenshots of the errors you're seeing and the exact process you're taking?


goatkenziee
PROOP

a month ago

yes one moment What’s happening / Why my deploys “look successful” but features don’t work

Railway is deploying correctly — the service builds from GitHub main, env vars load, /healthz is green, and logs show:

✅ Stripe initialized (key starts with sk_t)

So the problem is NOT Railway infra.

There are two app-level issues causing all the errors I’m seeing:

white_check_mark emoji 1. Credits checkout route returns {"package_id": "missing"}

On my frontend, the buttons link to:

/billing/credits/checkout

But the API expects:

POST /billing/credits/checkout  { "package_id": "...StripePriceID..." }

So it returns:

{"type":"missing","loc":["body","package_id"]}

This is not a Railway issue — my frontend links do not include the required ?package_id= query.

white_check_mark emoji 2. PRO checkout shows “add STRIPE_SECRET_KEY”

Stripe is initialized (startup logs confirm it).

That screen is just a generic fallback message from payments.py when a leftover import stripe is still used instead of my centralized Stripe client:

from services.stripe_client import stripe as stripe_sdk

Any route still calling:

stripe.checkout.Session.create(...)

instead of:

stripe_sdk.checkout.Session.create(...)

will fail the pre-check and show that fallback text.

This is application code — NOT Railway. all code changes are not updating also on new redeployment its stuck from like a month ago

hope this helps


goatkenziee
PROOP

a month ago

every new deployment is something old from weeks ago not current code. I have disconnected GitHub etc.


dev
MODERATOR

a month ago

How do you know its deploying old code? If it's only from the STRIPE api key missing, are you sure you did add your stripe API key in your railway service variables?


goatkenziee
PROOP

a month ago

yes I have added variables and double and triple checked. I believe the correct is being pulled but not added changes are not being displayed things I have changed form today even won't show updated


Add a line of code that prints out the STRIPE_API_KEY and/or STRIPE_SECRET_KEY env variable and check deployment logs to see if it's undefined or defined.

edit: add more info ish


0x5b62656e5d

Add a line of code that prints out the STRIPE_API_KEY and/or STRIPE_SECRET_KEY env variable and check deployment logs to see if it's undefined or defined.edit: add more info ish

goatkenziee
PROOP

a month ago

all the same messages


goatkenziee

all the same messages

By "same messages," did it print out the actual key or was it undefined?


0x5b62656e5d

By "same messages," did it print out the actual key or was it undefined?

goatkenziee
PROOP

a month ago

I added the print statements and checked the deployment logs.

Both STRIPE_API_KEY and STRIPE_SECRET_KEY printed out as: [REDACTED VALUE], meaning they ARE defined and not undefined.

The logs showed the actual key string, so the env vars exist.

The problem still happens even though the env vars are set.

What should I check next?


Okay so we now know that the deployment is working as intended. Given that the AI you used mentioned incorrect API routes, I would refer back to Stripe's API documentation for the checkout flow and ensure that the code follows it correctly.

You can also use Stripe's Sandbox feature to check that your code is working as intended.


0x5b62656e5d

Okay so we now know that the deployment is working as intended. Given that the AI you used mentioned incorrect API routes, I would refer back to Stripe's API documentation for the checkout flow and ensure that the code follows it correctly.You can also use Stripe's Sandbox feature to check that your code is working as intended.

goatkenziee
PROOP

a month ago

Thanks for the clarification.

So deployment works and the environment variables are loading correctly.

Since you're saying the AI introduced incorrect Stripe routes, can you confirm which specific Stripe endpoints or API patterns are invalid so I can correct the code? Stripe Checkout should just be using:

stripe.checkout.Session.create(...)

stripe.checkout.Session.retrieve(...)

I want to verify that the issue is not on Railway’s side and is solely in my code logic.

Any documentation links you recommend I follow directly would help, too.


https://docs.stripe.com/api/checkout/sessions?lang=python

Also, to be clear, I did not say the AI introduced incorrect routes. I said that the AI mentioned incorrect API routes/route usage.


0x5b62656e5d

https://docs.stripe.com/api/checkout/sessions?lang=pythonAlso, to be clear, I did not say the AI introduced incorrect routes. I said that the AI mentioned incorrect API routes/route usage.

goatkenziee
PROOP

a month ago

Apologies for the confusion Thanks! I’m aligning the code to the docs you linked.
I’m using:

stripe.checkout.Session.create(...)
stripe.checkout.Session.retrieve(session_id)

Centralized in services/stripe_client.py, with a /api/payments/stripe/health probe. I’ll test in Stripe test mode now.

services/stripe_client.py

import os, logging, stripe
log = logging.getLogger(__name__)
stripe_sdk = stripe

def ensure_stripe_api_key() -> None:
    if getattr(stripe_sdk, "api_key", None):
        return
    key = os.getenv("STRIPE_SECRET_KEY") or os.getenv("STRIPE_API_KEY")
    if not key:
        raise RuntimeError("Missing STRIPE_SECRET_KEY/STRIPE_API_KEY")
    stripe_sdk.api_key = key
    log.info("Stripe initialized; key_prefix=%s", key[:8])

def create_checkout_session(**kwargs):
    ensure_stripe_api_key()
    kwargs.setdefault("mode", "payment")
    kwargs.setdefault(
        "success_url",
        os.getenv("STRIPE_SUCCESS_URL",
                  "https://your.app/api/payments/checkout/success?session_id={CHECKOUT_SESSION_ID}")
    )
    kwargs.setdefault(
        "cancel_url",
        os.getenv("STRIPE_CANCEL_URL", "https://your.app/checkout/cancel")
    )
    # ✅ Official call
    return stripe_sdk.checkout.Session.create(**kwargs)

def retrieve_checkout_session(session_id: str):
    ensure_stripe_api_key()
    # ✅ Official call
    return stripe_sdk.checkout.Session.retrieve(session_id)

def stripe_health():
    try:
        ensure_stripe_api_key()
        return {"ok": True,
                "sdk_version": getattr(stripe_sdk, "__version__", "unknown"),
                "key_prefix": stripe_sdk.api_key[:8]}
    except Exception as e:
        return {"ok": False, "error": str(e)}

payments.py (public routes)

from fastapi import APIRouter, HTTPException
from services.stripe_client import (
    create_checkout_session, retrieve_checkout_session,
    ensure_stripe_api_key, stripe_health,
)

router = APIRouter(prefix="/api/payments", tags=["payments"])

@router.get("/stripe/health")
def get_health():
    status = stripe_health()
    if not status["ok"]:
        raise HTTPException(500, status)
    return status

@router.post("/checkout")
def start_checkout(price_id: str, qty: int = 1, customer_email: str | None = None):
    try:
        session = create_checkout_session(
            line_items=[{"price": price_id, "quantity": max(1, qty)}],
            customer_email=customer_email,
        )
        return {"id": session["id"], "url": session["url"]}
    except Exception as e:
        raise HTTPException(400, f"Stripe error: {e}")

@router.get("/checkout/success")
def checkout_success(session_id: str):
    try:
        s = retrieve_checkout_session(session_id)
        return {"status": s.get("status"), "payment_intent": s.get("payment_intent")}
    except Exception as e:
        raise HTTPException(400, f"Stripe retrieve error: {e}")

Remove services/stripe_service.py and standardize imports to services.stripe_client. is ther anyhing i can paste here that you can check specifically


goatkenziee
PROOP

a month ago

After looking at the logs, I can now confirm:

  1. Git branches in GitHub are out of sync

  2. Cursor commits were NOT merged

  3. Railway built the OLD code, not the new Stripe fixes

  4. The new Stripe health function NEVER reached main.py

  5. That’s why the endpoint 404s

  6. That’s why Stripe is still NoneType

it's fighting a deployment mismatch, not Stripe.


Didn't you successfully merge branches into main though? In the image attached above, you successfully merged PR 25 into main...


goatkenziee
PROOP

a month ago

yes I think i just need a new platform even my link in meail once clicked say are not found Im willing to pay someone to fix issues this has been a few weeks of same thing at this point. The changes are not updated in railway but show in github


When you push to main in Github, does Railway automatically redeploy the newest commit? (Is the most recent deploy based off of the newest commit hash?)


goatkenziee
PROOP

a month ago

yes, it does automatic redeployment, but changes don't show and i used a platform with same variables and things pointed and worked easily her at railway Api keys for emails don't work or point emails sent don't point checkout broken site has went backwards so latest changes are there but nothing changes .


goatkenziee
PROOP

a month ago

THANKS FOR YOUR HELP IM LEAVING RAILWAY NOT A GOOD SERVICE GOOD BYE


Status changed to Closed samgordon about 1 month ago


Loading...