Internal server error when generate embed link with branch param

Goal:
I am trying to create an embed URL using the route /api/embed-url/external-user, passing a JSON body with user and landing page information. However, when accessing the returned URL, I get a 500 error and the screen turns blank.

Steps:

  1. I made the POST request to the /api/embed-url/external-user route with the following body:

json

Copiar

{
	"environment": "development", 
	"branch": "development",
	"landingPageUuid": "7a297b14-1331-4115-801e-05c72ac46737", 
	"groupIds": [
		1
	],
	"externalIdentifier": "felipe@email.com.", 
	"userInfo": {
		"email": "felipe@email.com" 
	}
}
  1. The request returned the following response body with the embed URL:
{
	"embedUrl": "http://app.selfretool.com/embed-redirect?nonce=cde96658-ec87-4c2f-9bff-b952efe08f5e&destination=%2Fembedded%2Fauthed%2F23580674-0316-11ef-87a1-6fccee579940%3F_environment%3Ddevelopment%26_branch%3Ddevelopment"
}
  1. I tried accessing the returned URL, redirect to https://app.selretool.com/embedded/authed/7a297b14-1331-4115-801e-05c72ac46737?_environment=development&_branch=development but I received a 500 error and the screen turned blank.

Details:

  • The request was made to the URL http://app.selfretool.com/api/embed-url/external-user with the mentioned body.
  • The generated embed URL is: http://app.selfretool.com/embed-redirect?nonce=cde96658-ec87-4c2f-9bff-b952efe08f5e&destination=%2Fembedded%2Fauthed%2F7a297b14-1331-4115-801e-05c72ac46737%3F_environment%3Ddevelopment%26_branch%3Ddevelopment
  • The 500 error occurs when trying to access the embed URL.
  • {"error":true,"message":"Internal server error"}

Looking the retool api container logs i found this

    "error": {
        "level": "error",
        "msg": "Internal server error: n.getHead is not a function",
        "stack": "TypeError: n.getHead is not a function\n    at /retool_backend/bundle/main.js:6990:35640\n    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)",
        "type": "INTERNAL_ERROR"
    },~

Hey there, since you reached out internally let me share the fix here in case anyone else runs into this. Looks like this was due to a bug on our end that was fixed in our latest stable versions 3.148.x+ and our latest edge release 3.170.0+.

Another part of the issue is that the branch name needs to be the full branch name that you can see in the footer of your Retool App. Here is an example body that I used to successfully generate an embed URL with a specific branch, and environment:

{
    "landingPageUuid": "6925246a-04d8-25c0-35efd-6b01ddfd793a",
    "groupIds": [24],
    "environment": "production",
    "branch": "retool_repo/development",
    "externalIdentifier": "{{$guid}}",
    "userInfo": {
        "firstName": "Test",
        "lastName": "Embed",
        "email": "testembed@email.com"
    }
}

Hope this helps!

1 Like