Please ignore this. It was because the queue needed to be restarted. Well that was a giant waste of time. Sorry if anyone read through this!
env('APP_URL') Produces Different Results in Different Requests
I'm experiencing an issue where the URL for emails are returning my AWS ELB DNS name rather than the actual domain name we are using. The issue seems to be that my emails, which are sent via SQS, return the ELB DNS name when calling env('APP_URL') and config('app.url').
In my .env, I have the following:
APP_URL=https://staging.prod-domain.com
I added this to the RouteServiceProvider on my Staging server, which is hosted the same as the prod env, just with fewer resources:
\Log::error('Config URL: ' . config('app.url'));
\Log::error('.env URL: ' . env('APP_URL'));
And in my logs, I found this (which I obfuscated):
[2017-05-15 16:43:48] local.ERROR: Config URL: elb-name.us-west.elb.amazonaws.com
[2017-05-15 16:43:48] local.ERROR: .env URL: elb-name.us-west.elb.amazonaws.com
[2017-05-15 16:43:50] local.ERROR: Config URL: https://staging.prod-domain.com
[2017-05-15 16:43:50] local.ERROR: .env URL: https://staging.prod-domain.com
[2017-05-15 16:43:51] local.ERROR: Config URL: https://staging.prod-domain.com
[2017-05-15 16:43:51] local.ERROR: .env URL: https://staging.prod-domain.com
[2017-05-15 16:43:51] local.ERROR: Config URL: elb-name.us-west.elb.amazonaws.com
[2017-05-15 16:43:51] local.ERROR: .env URL: elb-name.us-west.elb.amazonaws.com
In the logs above, the lines for https://staging.prod-domain.com are coming from me viewing the site in the browser. The lines for elb-name.us-west.elb.amazonaws.com come from the Notification message being sent by SQS through my php artisan queue:listen --tries=3 command. Calling route('page-route') will produce an absolutely pathed URL that uses the domain coming through in the logs above.
I have made sure to run artisan config:clear && artisan cache:clear && artisan route:clear && artisan route:clear && artisan clear-compiled && artisan twig:clean just to be sure that there is no chance it could possible be a caching issue.
If it was just config('app.url') that was returning the wrong value, I could understand it; I would assume the .env file just wasn't be read. But with env('APP_URL') matching that output, I am completely at a loss now. Has anyone experienced this before or have any thought as to how to fix it?
Please or to participate in this conversation.