# authenticate.admin(request) server error

**URL:** <https://community.shopify.com/t/authenticate-admin-request-server-error/366004>\
**Category:** Authentication\
**Tags:** troubleshooting\
**Created:** [October 13, 2024, 12:36pm UTC](https://community.shopify.com/t/authenticate-admin-request-server-error/366004 "2024-10-13T12:36:15Z")\
**Posts on this page:** 1\
**Page:** 1

## AI-generated summary

A Shopify Remix app experiences a 500 server error when calling `authenticate.admin(request)` in production, though it works locally and returns 200 in Postman testing.

**Environment Details:**
- Recently migrated from SQLite to PostgreSQL
- Error occurs consistently in production regardless of request source
- Logs show: "No valid session found" → "Requesting offline access token" → 500 error

**Debugging Attempts:**
- Database connectivity verified - production DB accessible locally
- Prisma Session model and schema configuration confirmed correct
- Prisma Client debug mode enabled to capture database interactions
- Request headers, payloads, and responses logged throughout the flow
- CORS settings reviewed for cross-origin issues
- Authentication flow examined against Shopify requirements

**Key Observation:**
The error occurs *before* any attempt to create or retrieve a session from the Prisma database, suggesting the issue lies in the authentication middleware itself rather than database operations.

**Note:** Part of the original post appears corrupted/reversed, potentially indicating encoding or transmission issues during submission.

<div class="post-metadata">

**Author:** ![lili99](https://avatars.discourse-cdn.com/v4/letter/l/97f17d/32.png) [@lili99](https://community.shopify.com/u/lili99)\
**Post date:** [October 13, 2024, 12:36pm UTC](https://community.shopify.com/t/authenticate-admin-request-server-error/366004/1 "2024-10-13T12:36:15Z")

</div>

### **Issue Summary**

**Environment:**

- **App Framework** : Shopify App with Remix template
- **Database** : PostgreSQL (Previously SQLite, recently migrated)
- **Deployment** : The app functions correctly in the local environment but encounters issues in production.
- **Error Encountered** : When calling authenticate.admin(request), a 500 server error is returned in production, while it works as expected locally.
- **Postman Testing** : The request to authenticate.admin(request) returns a 200 response in Postman.

**Relevant Logs from Production:**

- Shopify logs indicate

- **Steps Taken to Debug**

1. **Verified Database Connectivity:**

2. **Session Storage and Prisma Configuration:**

3. **Confirmed Postman Compatibility:**

4. **Examined CORS and Authentication Flow:**

5. **Captured and Reviewed Detailed Logs:**

6. **Error Consistency:**
