I am trying to create an account on the stellar Test Network. But whenever I make a request and pass in the public key, I always get this error: I am using the Javascript documentation from here

1 Answer 1


As you can see in the URL, you pass "${encodeURIComponent...}" as a string, not as evaluated value. Your code is probably something like:

url = 'https://friendbot(...)?addr=${encodeURIComponent...}';

but should be like:

url = 'https://friendbot(...)?addr=' + encodeURIComponent...;
// or as a template string
url = `https://friendbot(...)?addr=${encodeURIComponent...}`;

...and since the public keys do not contain special characters, it's not neccessary to escape it.

url = 'https://friendbot(...)?addr=' + pair.publicKey();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.