smartlook / smartlook-relay-proxy

Smartlook Relay Proxy ⚡️
https://smartlook.com
MIT License
6 stars 4 forks source link

Deployed relay fails with `Origin is not allowed by Access-Control-Allow-Origin` #282

Closed troyschneringer closed 2 months ago

troyschneringer commented 3 months ago

Describe the bug All calls to smartlook using the relay proxy fail with Origin is not allowed by Access-Control-Allow-Origin

To Reproduce The relay is deployed to Google Cloud run via the following:

gcloud run deploy -q smartlook-relay \
    --image=smartlook/relay-proxy:latest \
    --cpu=1 --memory=256Mi \
    --platform=managed \
    --region=us-central1 \
    --allow-unauthenticated \
    --service-account=[IAM-SERVICE-ACCOUNT] \
    --port=8000

Domain mapping is setup and confirmed working with: curl https://smartlook.fons.com/recorder.js

Smartlook is installed on the client using smart look-client:

import smartlook from "smartlook-client";
smartlook.init([KEY], { relayProxyUrl: "https://smartlook.fons.com/"  });
smartlook.record({ forms: true, emails: true, ips: true, numbers: true });

If relayProxyUrl is omitted, everything works fine. However with relayProxyUrl set, recordings do not occur and networks calls to https://smartlook.fons.com/manager/rec/sessions/0p4M-n8zDo_3tvI9uOq-s/active?projectKey=[KEY] fail with a 500 and Origin is not allowed by Access-Control-Allow-Origin

Expected behavior Successful calls to smartlook and recordings appear in the dashboard.

Screenshots

Screenshot 2024-04-02 at 5 09 54 PM
js-supp commented 3 months ago

Can observe on https://next.fons.com/. @samialdury is this something with can help with?

troyschneringer commented 2 months ago

Turns out this was a GCP config issue. A previous version of the proxy had been deployed with the US environment variables. We when reverted to the defaults (by not setting the variables) Cloud Run did not clear out the old variable values causing a 500 error in the logs.