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

masonite api #736

Open
ssestantech opened this issue Nov 17, 2022 · 7 comments
Open

masonite api #736

ssestantech opened this issue Nov 17, 2022 · 7 comments
Labels

Comments

@ssestantech
Copy link

Describe the bug

i am using masonite api . its working perfect on localhost. but when i go to production then its showing
api routes not found 404.

Expected behaviour

i am using masonite api . its working perfect on localhost. but when i go to production then its showing
api routes not found 404.

Steps to reproduce the bug

No response

Screenshots

No response

OS

Linux

OS version

Linux

Browser

No response

Masonite Version

4.6.1

Anything else ?

No response

@girardinsamuel
Copy link
Contributor

girardinsamuel commented Nov 18, 2022

Can you test if your routes are correctly displayed in production with the python craft routes:list command ? It should display a list of the configured routes for the current environement. If it is displayed there then maybe it's not an issue with Masonite itself ?

Are you using a proxy like Nginx ?

@ssestantech
Copy link
Author

masonite.exceptions.exceptions.MissingContainerBindingNotFound: routes.api.location key was not found in the container

@ssestantech
Copy link
Author

image

@ssestantech
Copy link
Author

but api/users give 404

@ssestantech
Copy link
Author

masonite api not working on subdomain

@ssestantech
Copy link
Author

any solution

@circulon
Copy link
Contributor

circulon commented Jan 5, 2023

@ssestantech

masonite.exceptions.exceptions.MissingContainerBindingNotFound: routes.api.location key was not found in the container

As per the error shown in your screenshot the routes.api.location binding is missing.
As per the documentstion: https://docs.masoniteproject.com/features/api
You will then have to add a binding to the container for the location of this file. You can do so in your Kernel.py file inside the register_routes method:

Additionally check your APP_URL in config.application on your production system as this needs to be the full base endpoint as I understand it ie https://sub.domain.acme.com

Personally I found this quite limiting when it comes to deploying to multiple environments (ie local, dev, staging, prod) as I had to manually modify each env config for specific usage.
This is entirely due to visibility of env vars available to AWS Lambda.
So I extended the config mechanism to be fully inherited config stack that could be tracked in version control and built dynamically accoring to the deployed env requirements.
But thats just how I decided to do it for repeatability and ease of deployment

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

No branches or pull requests

3 participants